Class: AbstractInterface::ViewBuilder
- Inherits:
-
Object
- Object
- AbstractInterface::ViewBuilder
- Defined in:
- lib/abstract_interface/view_builder.rb
Constant Summary collapse
- PROXY_METHODS =
Template methods
%w{ capture concat content_for content_tag render themed_partial themed_partial_exist? themed_resource }
Instance Attribute Summary collapse
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(template) ⇒ ViewBuilder
constructor
A new instance of ViewBuilder.
-
#options(*args, &block) ⇒ Object
Builders.
Constructor Details
#initialize(template) ⇒ ViewBuilder
Returns a new instance of ViewBuilder.
21 22 23 |
# File 'lib/abstract_interface/view_builder.rb', line 21 def initialize template @template = template end |
Instance Attribute Details
#template ⇒ Object (readonly)
Returns the value of attribute template.
20 21 22 |
# File 'lib/abstract_interface/view_builder.rb', line 20 def template @template end |
Class Method Details
.generate_helper_methods(methods) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/abstract_interface/view_builder.rb', line 4 def self.generate_helper_methods methods methods.each do |folder, templates| templates.each do |template| code = %{\ def #{template} *args, &block render_haml_builder "#{folder}", "#{template}", *args, &block end} eval code, binding, __FILE__, __LINE__ end end end |
Instance Method Details
#options(*args, &block) ⇒ Object
Builders
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/abstract_interface/view_builder.rb', line 47 def *args, &block opt = args. args.size.should! :be_in, 0..1 opt[:content] = args.first if args.size == 1 HamlBuilder.get_input self.template, opt, &block # options.should! :be_a, Hash # block.should! :be_a, Proc # if block # b = HamlBuilder.new self.template # block.call b # options.merge b.get_value # else # options # end end |