Class: Attrocity::ModelAttribute
- Inherits:
-
Object
- Object
- Attrocity::ModelAttribute
- Defined in:
- lib/attrocity/attributes/model_attribute.rb
Instance Attribute Summary collapse
-
#model_class ⇒ Object
readonly
Returns the value of attribute model_class.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, model_class) ⇒ ModelAttribute
constructor
A new instance of ModelAttribute.
- #model(data) ⇒ Object
Constructor Details
#initialize(name, model_class) ⇒ ModelAttribute
Returns a new instance of ModelAttribute.
5 6 7 8 |
# File 'lib/attrocity/attributes/model_attribute.rb', line 5 def initialize(name, model_class) @name = name @model_class = model_class end |
Instance Attribute Details
#model_class ⇒ Object (readonly)
Returns the value of attribute model_class.
3 4 5 |
# File 'lib/attrocity/attributes/model_attribute.rb', line 3 def model_class @model_class end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/attrocity/attributes/model_attribute.rb', line 3 def name @name end |
Instance Method Details
#model(data) ⇒ Object
10 11 12 |
# File 'lib/attrocity/attributes/model_attribute.rb', line 10 def model(data) model_class.new(AttributesHash.new(data)).model end |