Module: Stencils::Stencil::ClassMethods

Defined in:
lib/stencils/stencil.rb

Instance Method Summary collapse

Instance Method Details

#stencil(name, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/stencils/stencil.rb', line 11

def stencil(name, options={})
  @stencil_name = name
  @stencil_options = options
  @stencil_options[:name] = name
  @stencil_options[:view_dir] ||= "stencils/#{name}"

  #define a method here like setup_rest_stencil for the before filter.
  #make the include and attr_accessor conditional so it only happens once.
  #do whatever else is necessary to alow multiple stencils. (use instance_var_set with :@rest_stencil_options)

  include RestStencil
  attr_accessor :stencil
  helper_method :stencil
  before_filter :stencil_filter
  helper "#{name.to_s.camelize}StencilHelper".constantize
end

#stencil_optionsObject



28
29
30
# File 'lib/stencils/stencil.rb', line 28

def stencil_options
  @stencil_options
end