Class: BlockHTML::Form::Element
- Defined in:
- lib/block-html/form.rb
Defined Under Namespace
Classes: Button, Checkbox, Input, Password
Instance Attribute Summary
Attributes inherited from BlockHTML
Instance Method Summary collapse
-
#initialize(model, attrs) ⇒ Element
constructor
A new instance of Element.
Methods inherited from BlockHTML
#<<, #_p, #doctype, #each, #empty?, #escaped_text, #form, #method_missing, #p, #path, #render, #root, #tag, #text, #to_s, #xml
Constructor Details
#initialize(model, attrs) ⇒ Element
Returns a new instance of Element.
82 83 84 85 86 87 88 89 |
# File 'lib/block-html/form.rb', line 82 def initialize(model, attrs) super() @model = model @attrs = attrs @name = @attrs[:name] @id = @attrs[:id] || @name @value = @model ? @model.__send__(@name) : @attrs[:value] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BlockHTML