Module: Campo
- Defined in:
- lib/campo.rb,
lib/campo/version.rb
Defined Under Namespace
Modules: Childish, Convenience, Helpers, Iding Classes: Base, Fieldset, Form, Haml_Ruby_Insert, Input, Label, Legend, Literal, Option, Select, Textarea
Constant Summary collapse
- VERSION =
"0.3.2"
Class Attribute Summary collapse
-
.atts ⇒ Object
Returns the value of attribute atts.
Class Method Summary collapse
-
.form(name, attributes = {}, &block) ⇒ Object
Generally, the first method you’ll call.
- .literal(*args, &block) ⇒ Object
-
.output(*args) ⇒ Object
Pass anything but the form for the first argument to not have the local variable defaults added to the top.
Class Attribute Details
.atts ⇒ Object
Returns the value of attribute atts.
158 159 160 |
# File 'lib/campo.rb', line 158 def atts @atts end |
Class Method Details
.form(name, attributes = {}, &block) ⇒ Object
Generally, the first method you’ll call.
305 306 307 |
# File 'lib/campo.rb', line 305 def self.form( name, attributes={}, &block ) Form.new( name, attributes, &block ) end |
.literal(*args, &block) ⇒ Object
230 231 232 |
# File 'lib/campo.rb', line 230 def self.literal( *args, &block ) Campo::Literal.new( *args, &block ) end |
.output(*args) ⇒ Object
Pass anything but the form for the first argument to not have the local variable defaults added to the top
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/campo.rb', line 241 def self.output( *args ) s = <<STR - atts = {} if atts.nil? - atts.default = {} if atts.default.nil? - inners = {} if inners.nil? - inners.default = "" if inners.default.nil? - i = 0 # for tabindex STR # default to true whole_form = if args.first.kind_of? Campo::Base true else args.shift false end output = Base.output( *args ) output = s + output if whole_form output end |