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.
684 685 686 687 688 689 690 691 692 693 694 695 696 |
# File 'lib/campo/campo.rb', line 684 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.
682 683 684 |
# File 'lib/campo/campo.rb', line 682 def attributes @attributes end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
682 683 684 |
# File 'lib/campo/campo.rb', line 682 def fields @fields end |