Class: RecordStore::Changeset::Change
- Inherits:
-
Object
- Object
- RecordStore::Changeset::Change
- Defined in:
- lib/record_store/changeset.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#record ⇒ Object
Returns the value of attribute record.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #addition? ⇒ Boolean
-
#initialize(type: nil, record: nil, id: nil) ⇒ Change
constructor
A new instance of Change.
- #removal? ⇒ Boolean
- #update? ⇒ Boolean
Constructor Details
#initialize(type: nil, record: nil, id: nil) ⇒ Change
Returns a new instance of Change.
6 7 8 9 10 |
# File 'lib/record_store/changeset.rb', line 6 def initialize(type: nil, record: nil, id: nil) @type = type @record = record @id = id end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/record_store/changeset.rb', line 4 def id @id end |
#record ⇒ Object
Returns the value of attribute record.
4 5 6 |
# File 'lib/record_store/changeset.rb', line 4 def record @record end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/record_store/changeset.rb', line 4 def type @type end |
Class Method Details
.addition(record) ⇒ Object
13 14 15 |
# File 'lib/record_store/changeset.rb', line 13 def addition(record) new(type: :addition, record: record) end |
.removal(record) ⇒ Object
17 18 19 |
# File 'lib/record_store/changeset.rb', line 17 def removal(record) new(type: :removal, record: record) end |
.update(id, record) ⇒ Object
21 22 23 |
# File 'lib/record_store/changeset.rb', line 21 def update(id, record) new(type: :update, record: record, id: id) end |
Instance Method Details
#addition? ⇒ Boolean
30 31 32 |
# File 'lib/record_store/changeset.rb', line 30 def addition? type == :addition end |
#removal? ⇒ Boolean
26 27 28 |
# File 'lib/record_store/changeset.rb', line 26 def removal? type == :removal end |
#update? ⇒ Boolean
34 35 36 |
# File 'lib/record_store/changeset.rb', line 34 def update? type == :update end |