Class: Campo::Label
Constant Summary collapse
- DEFAULT =
{ for: nil }
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
Attributes inherited from Base
#attributes The element's html attributes., #fields The element's child elements.
Attributes included from Childish
Instance Method Summary collapse
-
#initialize(for_element, inner = nil, attributes = {}) ⇒ Label
constructor
A new instance of Label.
Methods inherited from Base
#each, #labelled, #on_output, #output, output, quotable, unhash
Methods included from Convenience
#bit_of_ruby, #checkbox, #fieldset, #hidden, #input, #literal, #password, #radio, #select, #submit, #text, #textarea
Methods included from Iding
Methods included from Childish
Constructor Details
#initialize(for_element, inner = nil, attributes = {}) ⇒ Label
Returns a new instance of Label.
702 703 704 705 706 707 708 709 710 711 712 713 714 |
# File 'lib/campo/campo.rb', line 702 def initialize( for_element, inner=nil, attributes={} ) if inner.kind_of? Hash attributes = inner inner = nil end super( nil, attributes.merge(for: for_element) ) @inner = inner self.on_output do |n=0, tab=2| %Q!#{" " * n * tab}%label{ #{Base.unhash( @attributes )} }\n#{" " * (n + 1) * tab}#{@inner}! end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
700 701 702 |
# File 'lib/campo/campo.rb', line 700 def attributes @attributes end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
700 701 702 |
# File 'lib/campo/campo.rb', line 700 def fields @fields end |