Class: Pressy::RemoteChangeset::UpdatedPost
- Inherits:
-
Object
- Object
- Pressy::RemoteChangeset::UpdatedPost
- Defined in:
- lib/pressy/changeset/remote.rb
Instance Attribute Summary collapse
-
#post ⇒ Object
readonly
Returns the value of attribute post.
-
#rendered_post ⇒ Object
readonly
Returns the value of attribute rendered_post.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #execute(store, client) ⇒ Object
-
#initialize(rendered_post, post) ⇒ UpdatedPost
constructor
A new instance of UpdatedPost.
- #type ⇒ Object
Constructor Details
#initialize(rendered_post, post) ⇒ UpdatedPost
Returns a new instance of UpdatedPost
77 78 79 80 |
# File 'lib/pressy/changeset/remote.rb', line 77 def initialize(rendered_post, post) @rendered_post = rendered_post @post = post end |
Instance Attribute Details
#post ⇒ Object (readonly)
Returns the value of attribute post
75 76 77 |
# File 'lib/pressy/changeset/remote.rb', line 75 def post @post end |
#rendered_post ⇒ Object (readonly)
Returns the value of attribute rendered_post
75 76 77 |
# File 'lib/pressy/changeset/remote.rb', line 75 def rendered_post @rendered_post end |
Instance Method Details
#==(other) ⇒ Object
97 98 99 |
# File 'lib/pressy/changeset/remote.rb', line 97 def ==(other) rendered_post == other.rendered_post && post == other.post end |
#execute(store, client) ⇒ Object
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/pressy/changeset/remote.rb', line 82 def execute(store, client) saved = client.edit_post(post) rendered = Pressy::PostRenderer.render(saved) if rendered_post.path != rendered.path store.delete(saved.id, rendered_post) end store.write(saved.id, rendered) end |
#type ⇒ Object
93 94 95 |
# File 'lib/pressy/changeset/remote.rb', line 93 def type :update end |