Class: BlockHTML::Tag
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
Attributes inherited from BlockHTML
Instance Method Summary collapse
-
#initialize(name, attrs = {}, env_instance = nil, &block) ⇒ Tag
constructor
A new instance of Tag.
- #render(renderer) ⇒ Object
Methods inherited from BlockHTML
#<<, #_p, #doctype, #each, #empty?, #escaped_text, #form, #method_missing, #p, #path, #root, #tag, #text, #to_s, #xml
Constructor Details
#initialize(name, attrs = {}, env_instance = nil, &block) ⇒ Tag
Returns a new instance of Tag.
140 141 142 143 144 145 146 147 |
# File 'lib/block-html.rb', line 140 def initialize(name, attrs={}, env_instance=nil, &block) @name = name @attrs = attrs.inject(Attrs.new) do |ret, (key, val)| ret[key] = val ret end super(env_instance, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BlockHTML
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
138 139 140 |
# File 'lib/block-html.rb', line 138 def attrs @attrs end |
Instance Method Details
#render(renderer) ⇒ Object
149 150 151 |
# File 'lib/block-html.rb', line 149 def render(renderer) renderer.tag(self, @name, @attrs) end |