Class: ReactorSDK::Resources::LibraryComparison
- Inherits:
-
Object
- Object
- ReactorSDK::Resources::LibraryComparison
- Includes:
- Enumerable
- Defined in:
- lib/reactor_sdk/resources/library_comparison.rb
Instance Attribute Summary collapse
-
#baseline_library_id ⇒ Object
readonly
Returns the value of attribute baseline_library_id.
-
#baseline_snapshot ⇒ Object
readonly
Returns the value of attribute baseline_snapshot.
-
#current_library_id ⇒ Object
readonly
Returns the value of attribute current_library_id.
-
#current_snapshot ⇒ Object
readonly
Returns the value of attribute current_snapshot.
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#property_id ⇒ Object
readonly
Returns the value of attribute property_id.
Instance Method Summary collapse
- #added_entries ⇒ Object
- #baseline_library ⇒ Object
- #changed_entries ⇒ Object
- #changeset_documents(include_unchanged: false) ⇒ Object
- #current_library ⇒ Object
- #each ⇒ Object
-
#initialize(current_library_id:, baseline_library_id:, property_id:, current_snapshot:, baseline_snapshot:, entries:) ⇒ LibraryComparison
constructor
A new instance of LibraryComparison.
- #modified_entries ⇒ Object
- #removed_entries ⇒ Object
- #unchanged_entries ⇒ Object
Constructor Details
#initialize(current_library_id:, baseline_library_id:, property_id:, current_snapshot:, baseline_snapshot:, entries:) ⇒ LibraryComparison
Returns a new instance of LibraryComparison.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 15 def initialize( current_library_id:, baseline_library_id:, property_id:, current_snapshot:, baseline_snapshot:, entries: ) @current_library_id = current_library_id @baseline_library_id = baseline_library_id @property_id = property_id @current_snapshot = current_snapshot @baseline_snapshot = baseline_snapshot @entries = Array(entries) end |
Instance Attribute Details
#baseline_library_id ⇒ Object (readonly)
Returns the value of attribute baseline_library_id.
8 9 10 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 8 def baseline_library_id @baseline_library_id end |
#baseline_snapshot ⇒ Object (readonly)
Returns the value of attribute baseline_snapshot.
8 9 10 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 8 def baseline_snapshot @baseline_snapshot end |
#current_library_id ⇒ Object (readonly)
Returns the value of attribute current_library_id.
8 9 10 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 8 def current_library_id @current_library_id end |
#current_snapshot ⇒ Object (readonly)
Returns the value of attribute current_snapshot.
8 9 10 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 8 def current_snapshot @current_snapshot end |
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
8 9 10 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 8 def entries @entries end |
#property_id ⇒ Object (readonly)
Returns the value of attribute property_id.
8 9 10 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 8 def property_id @property_id end |
Instance Method Details
#added_entries ⇒ Object
43 44 45 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 43 def added_entries @entries.select(&:added?) end |
#baseline_library ⇒ Object
35 36 37 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 35 def baseline_library @baseline_snapshot.library end |
#changed_entries ⇒ Object
59 60 61 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 59 def changed_entries @entries.reject(&:unchanged?) end |
#changeset_documents(include_unchanged: false) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 63 def changeset_documents(include_unchanged: false) selected_entries = include_unchanged ? @entries : changed_entries selected_entries.each_with_index.map do |entry, index| entry.changeset_document(position: index) end end |
#current_library ⇒ Object
31 32 33 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 31 def current_library @current_snapshot.library end |
#each ⇒ Object
39 40 41 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 39 def each(&) @entries.each(&) end |
#modified_entries ⇒ Object
51 52 53 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 51 def modified_entries @entries.select(&:modified?) end |
#removed_entries ⇒ Object
47 48 49 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 47 def removed_entries @entries.select(&:removed?) end |
#unchanged_entries ⇒ Object
55 56 57 |
# File 'lib/reactor_sdk/resources/library_comparison.rb', line 55 def unchanged_entries @entries.select(&:unchanged?) end |