Class: Pressy::LocalChangeset::UpdatedPost
- Inherits:
-
Object
- Object
- Pressy::LocalChangeset::UpdatedPost
- Defined in:
- lib/pressy/changeset/local.rb
Querying the Changes collapse
-
#existing_post ⇒ Object
readonly
Returns the value of attribute existing_post.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#updated_post ⇒ Object
readonly
Returns the value of attribute updated_post.
Querying the Changes collapse
- #==(other) ⇒ Object
- #execute(store) ⇒ Object
-
#initialize(id, existing, updated) ⇒ UpdatedPost
constructor
A new instance of UpdatedPost.
- #type ⇒ Object
Constructor Details
#initialize(id, existing, updated) ⇒ UpdatedPost
Returns a new instance of UpdatedPost
110 111 112 113 114 |
# File 'lib/pressy/changeset/local.rb', line 110 def initialize(id, existing, updated) @id = id @existing_post = existing @updated_post = updated end |
Instance Attribute Details
#existing_post ⇒ Object (readonly)
Returns the value of attribute existing_post
108 109 110 |
# File 'lib/pressy/changeset/local.rb', line 108 def existing_post @existing_post end |
#id ⇒ Object (readonly)
Returns the value of attribute id
108 109 110 |
# File 'lib/pressy/changeset/local.rb', line 108 def id @id end |
#updated_post ⇒ Object (readonly)
Returns the value of attribute updated_post
108 109 110 |
# File 'lib/pressy/changeset/local.rb', line 108 def updated_post @updated_post end |
Instance Method Details
#==(other) ⇒ Object
128 129 130 |
# File 'lib/pressy/changeset/local.rb', line 128 def ==(other) existing_post == other.existing_post && updated_post == other.updated_post end |
#execute(store) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/pressy/changeset/local.rb', line 116 def execute(store) if existing_post.path != updated_post.path store.delete(id, existing_post) end store.write(id, updated_post) end |
#type ⇒ Object
124 125 126 |
# File 'lib/pressy/changeset/local.rb', line 124 def type :update end |