Module: Campo
- Defined in:
- lib/campo/campo.rb,
lib/campo/plugins.rb,
lib/campo/version.rb,
lib/campo/plugins/aria.rb,
lib/campo/plugins/partial.rb,
lib/campo/plugins/jqueryvalidation.rb
Defined Under Namespace
Modules: Childish, Convenience, Helpers, Iding, Plugins Classes: Base, Fieldset, Form, Haml_Ruby_Insert, Input, Label, Legend, Literal, Option, Outputter, Select, Span, Textarea
Constant Summary collapse
- VERSION =
"0.11.0"
Class Attribute Summary collapse
-
.atts ⇒ Object
Returns the value of attribute atts.
Class Method Summary collapse
- .constantize(camel_cased_word) ⇒ Object
-
.form(name, attributes = {}, &block) ⇒ Object
Probably, the first method you’ll call.
- .literal(*args, &block) ⇒ Object
-
.output(fields, options = {}) ⇒ Object
Pass anything but the form for the first argument to not have the local variable defaults added to the top.
- .plugin(name, options = {}) ⇒ Object
-
.plugins ⇒ Object
keeps track of the current plugins.
Class Attribute Details
.atts ⇒ Object
Returns the value of attribute atts.
223 224 225 |
# File 'lib/campo/campo.rb', line 223 def atts @atts end |
Class Method Details
.constantize(camel_cased_word) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/campo/campo.rb', line 34 def self.constantize(camel_cased_word) names = camel_cased_word.split('::') names.shift if names.empty? || names.first.empty? constant = Object names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name,false) : constant.const_missing(name) end constant end |
.form(name, attributes = {}, &block) ⇒ Object
Probably, the first method you’ll call.
464 465 466 |
# File 'lib/campo/campo.rb', line 464 def self.form( name, attributes={}, &block ) Form.new( name, attributes, &block ) end |
.literal(*args, &block) ⇒ Object
355 356 357 |
# File 'lib/campo/campo.rb', line 355 def self.literal( *args, &block ) Campo::Literal.new( *args, &block ) end |
.output(fields, options = {}) ⇒ Object
Pass anything but the form for the first argument to not have the local variable defaults added to the top
367 368 369 |
# File 'lib/campo/campo.rb', line 367 def self.output( fields, ={} ) Outputter.new( .delete(:tab) ).run( fields, ) end |
.plugin(name, options = {}) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/campo/campo.rb', line 52 def self.plugin( name, ={} ) unless plugins.include? name modname = (str = name.to_s) && (str[0,1].upcase + str[1..-1]) plugins[name] = constantize("Campo::Plugins::#{modname}").new plugins[name].plugged_in end end |
.plugins ⇒ Object
keeps track of the current plugins
47 48 49 |
# File 'lib/campo/campo.rb', line 47 def self.plugins @plugins ||= {} end |