Class: Gdshowsdb::Diff
- Inherits:
-
Object
show all
- Defined in:
- lib/gdshowsdb/diff.rb
Instance Method Summary
collapse
Constructor Details
#initialize(from_yaml, from_db) ⇒ Diff
Returns a new instance of Diff.
3
4
5
6
7
8
|
# File 'lib/gdshowsdb/diff.rb', line 3
def initialize(from_yaml, from_db)
@from_yaml = from_yaml
@yaml_uuids = (@from_yaml)
@from_db = from_db
@db_uuids = (@from_db)
end
|
Instance Method Details
#added ⇒ Object
10
11
12
13
14
|
# File 'lib/gdshowsdb/diff.rb', line 10
def added
(@from_yaml - @from_db).reject do |item|
@db_uuids.member?(item[:uuid])
end
end
|
#removed ⇒ Object
16
17
18
19
20
|
# File 'lib/gdshowsdb/diff.rb', line 16
def removed
(@from_db - @from_yaml).reject do |item|
@yaml_uuids.member?(item[:uuid])
end
end
|
#updated ⇒ Object
22
23
24
25
26
|
# File 'lib/gdshowsdb/diff.rb', line 22
def updated
(@from_yaml - @from_db).select do |item|
@yaml_uuids.member?(item[:uuid]) && @db_uuids.member?(item[:uuid])
end
end
|