Class: FlixCloud::Record
- Inherits:
-
Object
- Object
- FlixCloud::Record
- Defined in:
- lib/flix_cloud/record.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes=(attrs) ⇒ Object
-
#initialize(attrs = {}) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(attrs = {}) ⇒ Record
Returns a new instance of Record.
5 6 7 8 |
# File 'lib/flix_cloud/record.rb', line 5 def initialize(attrs={}) self.errors = [] self.attributes = attrs end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'lib/flix_cloud/record.rb', line 3 def errors @errors end |
Class Method Details
.record_column(attribute, klass) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/flix_cloud/record.rb', line 16 def self.record_column(attribute, klass) eval %{ attr_reader :#{attribute} def #{attribute}=(value) if @#{attribute} @#{attribute}.attributes = value else @#{attribute} = FlixCloud::#{klass}.new(value) end end } end |
Instance Method Details
#attributes=(attrs) ⇒ Object
10 11 12 13 14 |
# File 'lib/flix_cloud/record.rb', line 10 def attributes=(attrs) attrs.each do |key, value| send("#{key}=", value) if respond_to?("#{key}=") end end |