Class: Pressy::RemoteChangeset
- Inherits:
-
Object
- Object
- Pressy::RemoteChangeset
show all
- Defined in:
- lib/pressy/changeset/remote.rb
Defined Under Namespace
Classes: AddedPost, UpdatedPost
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RemoteChangeset
2
3
4
5
6
|
# File 'lib/pressy/changeset/remote.rb', line 2
def initialize
@added_posts = []
@local_posts = {}
@server_posts = {}
end
|
Instance Method Details
#add_local_post(rendered_post, post) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/pressy/changeset/remote.rb', line 8
def add_local_post(rendered_post, post)
if post.id
@local_posts[post.id] = [rendered_post, post]
else
@added_posts << [rendered_post, post]
end
self
end
|
#add_server_post(post) ⇒ Object
17
18
19
20
|
# File 'lib/pressy/changeset/remote.rb', line 17
def add_server_post(post)
@server_posts[post.id] = post
self
end
|
#changes ⇒ Object
26
27
28
|
# File 'lib/pressy/changeset/remote.rb', line 26
def changes
@changes ||= build_changes
end
|
#has_changes? ⇒ Boolean
22
23
24
|
# File 'lib/pressy/changeset/remote.rb', line 22
def has_changes?
!changes.empty?
end
|