Class: FlexiModel::Fields::FlexiField
- Inherits:
-
Object
- Object
- FlexiModel::Fields::FlexiField
- Defined in:
- lib/flexi_model/fields.rb
Instance Attribute Summary collapse
-
#accessible ⇒ Object
Returns the value of attribute accessible.
-
#default ⇒ Object
Returns the value of attribute default.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#plural ⇒ Object
Returns the value of attribute plural.
-
#singular ⇒ Object
Returns the value of attribute singular.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type, default = nil) ⇒ FlexiField
constructor
A new instance of FlexiField.
- #value(context) ⇒ Object
Constructor Details
#initialize(name, type, default = nil) ⇒ FlexiField
Returns a new instance of FlexiField.
274 275 276 277 278 279 |
# File 'lib/flexi_model/fields.rb', line 274 def initialize(name, type, default = nil) @name = name @type = type @default = default @options = { } end |
Instance Attribute Details
#accessible ⇒ Object
Returns the value of attribute accessible.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def accessible @accessible end |
#default ⇒ Object
Returns the value of attribute default.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def default @default end |
#name ⇒ Object
Returns the value of attribute name.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def @options end |
#plural ⇒ Object
Returns the value of attribute plural.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def plural @plural end |
#singular ⇒ Object
Returns the value of attribute singular.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def singular @singular end |
#type ⇒ Object
Returns the value of attribute type.
272 273 274 |
# File 'lib/flexi_model/fields.rb', line 272 def type @type end |
Instance Method Details
#value(context) ⇒ Object
281 282 283 284 285 286 287 |
# File 'lib/flexi_model/fields.rb', line 281 def value(context) if default.is_a?(Proc) default.call(context) else default end end |