Class: PollEverywhere::Serializable::Property
- Inherits:
-
Object
- Object
- PollEverywhere::Serializable::Property
- Includes:
- Configurable
- Defined in:
- lib/polleverywhere/serializable.rb
Overview
Property is somewhat of a metaclass that stores validations, name, etc. for the fields that belond to a serializable model. Since a Property lives at the class level, we have a Value class that
Defined Under Namespace
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#validations ⇒ Object
Returns the value of attribute validations.
Instance Method Summary collapse
-
#initialize(name, configuration = {}) ⇒ Property
constructor
A new instance of Property.
- #value ⇒ Object
Methods included from Configurable
Constructor Details
#initialize(name, configuration = {}) ⇒ Property
Returns a new instance of Property.
36 37 38 39 40 41 42 |
# File 'lib/polleverywhere/serializable.rb', line 36 def initialize(name, configuration={}) self.name = name.to_sym # Set attributes on the class from a given hash configuration.each do |attr, args| self.send("#{attr}=", *args) if self.respond_to? "#{attr}=" end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
32 33 34 |
# File 'lib/polleverywhere/serializable.rb', line 32 def name @name end |
#validations ⇒ Object
Returns the value of attribute validations.
32 33 34 |
# File 'lib/polleverywhere/serializable.rb', line 32 def validations @validations end |