Module: Riik::Document::ClassMethods

Defined in:
lib/riik/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#riik_attributesObject (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

#bucketRiak::Bucket

Returns the Riak bucket for this object.

Returns:

  • (Riak::Bucket)


40
41
42
# File 'lib/riik/document.rb', line 40

def bucket
  @bucket ||= Riik.client.bucket(bucket_name)
end

#bucket_nameString

Returns the bucket name for this object. Override in your class to change.

Returns:

  • (String)

    bucket name.



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