Module: Ropl::Composition

Defined in:
lib/ropl/composition.rb

Defined Under Namespace

Modules: ClassMethods Classes: Error

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#keyObject

Returns the value of attribute key.



9
10
11
# File 'lib/ropl/composition.rb', line 9

def key
  @key
end

#roplObject

Returns the value of attribute ropl.



9
10
11
# File 'lib/ropl/composition.rb', line 9

def ropl
  @ropl
end

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/ropl/composition.rb', line 5

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#persistObject

Raises:



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ropl/composition.rb', line 11

def persist
  ropl = self.class.class_variable_get :@@ropl_object

  raise Error if ropl.nil?

  if @key.nil?
    @key = ropl.post self
  else
    ropl.put self, @key
  end
  @key
end