Class: Campo::Literal
Overview
Add whatever you need to with a literal.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#attributes, #attributes The element's html attributes., #fields, #fields The element's child elements.
Attributes included from Childish
Instance Method Summary collapse
-
#initialize(s, attributes = {}) ⇒ Literal
constructor
A new instance of Literal.
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(s, attributes = {}) ⇒ Literal
Returns a new instance of Literal.
489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
# File 'lib/campo/campo.rb', line 489 def initialize( s, attributes={} ) super( nil, attributes ) # no name needed @s = s self.on_output do |n=0, tab=2| left,right = if @attributes.empty? ['',''] else ['{ ', '}'] end %Q!#{" " * n * tab}#{@s}! + left + Base.unhash( @attributes ) + right end self end |