Middleman,我在哪里可以添加自定义方法,这些方法可以修改视图的输出

时间:2015-07-21 18:31:21

标签: ruby sinatra middleman

我正在使用中间人来构建API描述网页,我想知道是否可以在某处定义用于以所需格式解析YAML的方法,基本上我正在寻找可以放置帮助器的地方方法

1 个答案:

答案 0 :(得分:1)

我把我放在# Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <VirtualHost *:80> ServerName localhost DocumentRoot "E:\Data\Users Apps\wamp\www\socialclub" </VirtualHost> <Directory "E:\Data\Users Apps\wamp\www\socialclub"> AllowOverride All Order Allow,Deny Allow from all Options Indexes FollowSymLinks Includes ExecCGI </Directory> <VirtualHost *:80> DocumentRoot "E:\Data\Users Apps\wamp\www\socialclub" ServerName www.socialclub.com </VirtualHost> config.rb区内,例如

helpers

然后,该帮助程序将在模板中使用。

修改:我找到了the section of the docs for defining custom helpers