Class: AttributeChanger::Committer

Inherits:
Object
  • Object
show all
Defined in:
lib/attribute_changer/committer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_change) ⇒ Committer

Returns a new instance of Committer.



4
5
6
7
# File 'lib/attribute_changer/committer.rb', line 4

def initialize(attribute_change)
  @result = AttributeChanger::Utils::Result.new nil, nil
  @attribute_change = attribute_change
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



2
3
4
# File 'lib/attribute_changer/committer.rb', line 2

def error
  @error
end

#invalid_attribsObject (readonly)

Returns the value of attribute invalid_attribs.



2
3
4
# File 'lib/attribute_changer/committer.rb', line 2

def invalid_attribs
  @invalid_attribs
end

#resultObject (readonly)

Returns the value of attribute result.



2
3
4
# File 'lib/attribute_changer/committer.rb', line 2

def result
  @result
end

Instance Method Details

#acceptObject



11
12
13
14
15
16
17
18
# File 'lib/attribute_changer/committer.rb', line 11

def accept
  if update_obj
    @result.success = true
  else
    @result.success = false
    false
  end
end

#attrib_changeObject



9
# File 'lib/attribute_changer/committer.rb', line 9

def attrib_change; @attribute_change end

#rejectObject



20
21
22
# File 'lib/attribute_changer/committer.rb', line 20

def reject
  update_status :rejected
end