Class: Poncho::Param
- Inherits:
-
Object
- Object
- Poncho::Param
- Defined in:
- lib/poncho/param.rb
Direct Known Subclasses
Poncho::Params::ArrayParam, Poncho::Params::BooleanParam, Poncho::Params::BooleanStringParam, Poncho::Params::IntegerParam, Poncho::Params::ObjectParam, Poncho::Params::ResourceParam, Poncho::Params::StringParam
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #convert(value) ⇒ Object
-
#initialize(name, options = {}) ⇒ Param
constructor
A new instance of Param.
- #type ⇒ Object
- #validate_each(record, attribute, value) ⇒ Object
Constructor Details
#initialize(name, options = {}) ⇒ Param
Returns a new instance of Param.
13 14 15 16 |
# File 'lib/poncho/param.rb', line 13 def initialize(name, = {}) @name = name.to_sym @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/poncho/param.rb', line 11 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/poncho/param.rb', line 11 def @options end |
Class Method Details
.type ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/poncho/param.rb', line 3 def self.type @type ||= begin full_name = name.split('::').last full_name = full_name.gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase full_name.sub(/_param$/, '').to_sym end end |
Instance Method Details
#convert(value) ⇒ Object
25 26 27 |
# File 'lib/poncho/param.rb', line 25 def convert(value) value end |
#type ⇒ Object
18 19 20 |
# File 'lib/poncho/param.rb', line 18 def type self.class.type end |
#validate_each(record, attribute, value) ⇒ Object
22 23 |
# File 'lib/poncho/param.rb', line 22 def validate_each(record, attribute, value) end |