Class: ActiveDynamic::AttributeDefinition
- Inherits:
-
Object
- Object
- ActiveDynamic::AttributeDefinition
- Defined in:
- lib/active_dynamic/attribute_definition.rb
Instance Attribute Summary collapse
-
#datatype ⇒ Object
readonly
Returns the value of attribute datatype.
-
#display_name ⇒ Object
readonly
Returns the value of attribute display_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(display_name, params = {}) ⇒ AttributeDefinition
constructor
A new instance of AttributeDefinition.
- #required? ⇒ Boolean
Constructor Details
#initialize(display_name, params = {}) ⇒ AttributeDefinition
Returns a new instance of AttributeDefinition.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/active_dynamic/attribute_definition.rb', line 6 def initialize(display_name, params = {}) = params.dup @name = (.delete(:system_name) || display_name).parameterize.underscore @display_name = display_name @datatype = .delete(:datatype) @value = .delete(:default_value) @required = .delete(:required) || false # custom attributes from Provider .each do |key, value| self.instance_variable_set("@#{key}", value) self.class.send(:attr_reader, key) end end |
Instance Attribute Details
#datatype ⇒ Object (readonly)
Returns the value of attribute datatype.
4 5 6 |
# File 'lib/active_dynamic/attribute_definition.rb', line 4 def datatype @datatype end |
#display_name ⇒ Object (readonly)
Returns the value of attribute display_name.
4 5 6 |
# File 'lib/active_dynamic/attribute_definition.rb', line 4 def display_name @display_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/active_dynamic/attribute_definition.rb', line 4 def name @name end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
4 5 6 |
# File 'lib/active_dynamic/attribute_definition.rb', line 4 def required @required end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/active_dynamic/attribute_definition.rb', line 4 def value @value end |
Instance Method Details
#required? ⇒ Boolean
21 22 23 |
# File 'lib/active_dynamic/attribute_definition.rb', line 21 def required? !!@required end |