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 included from Childish
Instance Method Summary collapse
-
#initialize(name, inner = nil, attributes = {}) ⇒ Label
constructor
A new instance of Label.
Methods inherited from Base
#labelled, #on_output, #output, output, quotable, unhash
Methods included from Convenience
#bit_of_ruby, #checkbox, #fieldset, #input, #literal, #radio, #select, #submit, #text, #textarea
Methods included from Iding
Methods included from Childish
Constructor Details
#initialize(name, inner = nil, attributes = {}) ⇒ Label
Returns a new instance of Label.
489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/campo.rb', line 489 def initialize( name, inner=nil, attributes={} ) if inner.kind_of? Hash attributes = inner inner = nil end super( name, attributes ) @inner = inner self.on_output do |n=0, tab=2| %Q!#{" " * n * tab}%label{ for: "#{@attributes[:name]}", #{Base.unhash( @attributes, :name )} }\n#{" " * (n + 1) * tab}#{@inner}! end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
487 488 489 |
# File 'lib/campo.rb', line 487 def attributes @attributes end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
487 488 489 |
# File 'lib/campo.rb', line 487 def fields @fields end |