Class: BlockHTML::Form::Element

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

Direct Known Subclasses

Button, Checkbox, Input, Password

Defined Under Namespace

Classes: Button, Checkbox, Input, Password

Instance Attribute Summary

Attributes inherited from BlockHTML

#parent

Instance Method Summary collapse

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