Module: Riik::Document::ClassMethods
- Defined in:
- lib/riik/document.rb
Instance Attribute Summary collapse
-
#riik_attributes ⇒ Object
readonly
List of model properties that should be assigned from the attributes hash.
Instance Method Summary collapse
-
#bucket ⇒ Riak::Bucket
Returns the Riak bucket for this object.
-
#bucket_name ⇒ String
Returns the bucket name for this object.
-
#property(attribute) ⇒ Object
Create accessors for each of the properties of the model.
Instance Attribute Details
#riik_attributes ⇒ Object (readonly)
List of model properties that should be assigned from the attributes hash.
23 24 25 |
# File 'lib/riik/document.rb', line 23 def riik_attributes @riik_attributes end |
Instance Method Details
#bucket ⇒ Riak::Bucket
Returns the Riak bucket for this object.
40 41 42 |
# File 'lib/riik/document.rb', line 40 def bucket @bucket ||= Riik.client.bucket(bucket_name) end |
#bucket_name ⇒ String
Returns the bucket name for this object. Override in your class to change.
49 50 51 |
# File 'lib/riik/document.rb', line 49 def bucket_name self.to_s.gsub(/::/, '_').downcase end |
#property(attribute) ⇒ Object
Create accessors for each of the properties of the model.
29 30 31 32 33 34 |
# File 'lib/riik/document.rb', line 29 def property(attribute) @riik_attributes ||= [] @riik_attributes << attribute attr_accessor attribute end |