Class: Believer::Base
- Inherits:
-
Object
- Object
- Believer::Base
- Extended by:
- ActiveModel::Naming, Querying
- Includes:
- ActiveModel::Observing, Callbacks, Columns, Connection, DDL, Environment, ModelSchema, Persistence, Scoping
- Defined in:
- lib/believer/base.rb
Constant Summary
Constants included from Callbacks
Instance Attribute Summary collapse
-
#id ⇒ Object
The Cassandra row ID.
Class Method Summary collapse
Instance Method Summary collapse
- #==(obj) ⇒ Object
-
#initialize(attrs = {}) ⇒ Base
constructor
A new instance of Base.
Methods included from Callbacks
Methods included from Persistence
Methods included from Columns
#attribute_names, #attributes, #attributes=, #equal_key_values?, #has_attribute?, #key_values, #read_attribute, #write_attribute
Constructor Details
#initialize(attrs = {}) ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/believer/base.rb', line 21 def initialize(attrs = {}) @attributes = {} #puts "Attrs: #{attrs.to_json}" #self.class.columns.each do |name, colum_definition| # send("#{name}=".to_sym, attrs[name.to_s]) #end if attrs.present? attrs.each do |name, val| send("#{name}=".to_sym, val) end if attrs.present? end |
Instance Attribute Details
#id ⇒ Object
The Cassandra row ID
19 20 21 |
# File 'lib/believer/base.rb', line 19 def id @id end |
Class Method Details
.instantiate_from_result_rows(row) ⇒ Object
32 33 34 |
# File 'lib/believer/base.rb', line 32 def self.instantiate_from_result_rows(row) new(row) end |
Instance Method Details
#==(obj) ⇒ Object
36 37 38 39 40 |
# File 'lib/believer/base.rb', line 36 def ==(obj) return false if obj.nil? return false unless obj.is_a?(self.class) equal_key_values?(obj) end |