Class: CassandraRecord::Base
- Inherits:
-
Object
- Object
- CassandraRecord::Base
- Defined in:
- lib/cassandra_record/base.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(attributes = {}) ⇒ Base
constructor
A new instance of Base.
- #where(options = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
19 20 21 |
# File 'lib/cassandra_record/base.rb', line 19 def initialize(attributes={}) @attributes = HashWithIndifferentAccess.new(attributes) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object (private)
48 49 50 51 52 53 54 |
# File 'lib/cassandra_record/base.rb', line 48 def method_missing(method, *args, &block) if attributes.has_key?(method) attributes[method] else super(method, *args, &block) end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
17 18 19 |
# File 'lib/cassandra_record/base.rb', line 17 def attributes @attributes end |
Class Method Details
.create(attributes) ⇒ Object
8 9 10 |
# File 'lib/cassandra_record/base.rb', line 8 def create(attributes) new(attributes).create end |
.where(attributes = {}) ⇒ Object
12 13 14 |
# File 'lib/cassandra_record/base.rb', line 12 def where(attributes={}) new.where(attributes) end |