Class: BlockHTML::Tag

Inherits:
BlockHTML show all
Defined in:
lib/block-html.rb

Direct Known Subclasses

Form::Tag

Instance Attribute Summary collapse

Attributes inherited from BlockHTML

#parent

Instance Method Summary collapse

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

#attrsObject (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