Class: ReactorSDK::Resources::UpstreamChain
- Inherits:
-
Object
- Object
- ReactorSDK::Resources::UpstreamChain
- Includes:
- Enumerable
- Defined in:
- lib/reactor_sdk/resources/upstream_chain.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#property_id ⇒ Object
readonly
Returns the value of attribute property_id.
-
#resource_id ⇒ Object
readonly
Returns the value of attribute resource_id.
-
#resource_type ⇒ Object
readonly
Returns the value of attribute resource_type.
-
#target_library_id ⇒ Object
readonly
Returns the value of attribute target_library_id.
-
#target_resource ⇒ Object
readonly
Returns the value of attribute target_resource.
-
#target_revision_id ⇒ Object
readonly
Returns the value of attribute target_revision_id.
Instance Method Summary collapse
- #each {|entry| ... } ⇒ Array<ReactorSDK::Resources::UpstreamChainEntry>
-
#found? ⇒ Boolean
True when any upstream library contains the resource.
-
#initialize(resource_id:, resource_type:, property_id:, target_library_id:, target_resource:, target_revision_id:, entries:) ⇒ UpstreamChain
constructor
A new instance of UpstreamChain.
-
#inspect ⇒ String
Human-readable representation.
- #nearest_match ⇒ ReactorSDK::Resources::UpstreamChainEntry?
Constructor Details
#initialize(resource_id:, resource_type:, property_id:, target_library_id:, target_resource:, target_revision_id:, entries:) ⇒ UpstreamChain
Returns a new instance of UpstreamChain.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 28 def initialize( resource_id:, resource_type:, property_id:, target_library_id:, target_resource:, target_revision_id:, entries: ) @resource_id = resource_id @resource_type = resource_type @property_id = property_id @target_library_id = target_library_id @target_resource = target_resource @target_revision_id = target_revision_id @entries = Array(entries) end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def entries @entries end |
#property_id ⇒ Object (readonly)
Returns the value of attribute property_id.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def property_id @property_id end |
#resource_id ⇒ Object (readonly)
Returns the value of attribute resource_id.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def resource_id @resource_id end |
#resource_type ⇒ Object (readonly)
Returns the value of attribute resource_type.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def resource_type @resource_type end |
#target_library_id ⇒ Object (readonly)
Returns the value of attribute target_library_id.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def target_library_id @target_library_id end |
#target_resource ⇒ Object (readonly)
Returns the value of attribute target_resource.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def target_resource @target_resource end |
#target_revision_id ⇒ Object (readonly)
Returns the value of attribute target_revision_id.
20 21 22 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 20 def target_revision_id @target_revision_id end |
Instance Method Details
#each {|entry| ... } ⇒ Array<ReactorSDK::Resources::UpstreamChainEntry>
50 51 52 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 50 def each(&) @entries.each(&) end |
#found? ⇒ Boolean
Returns true when any upstream library contains the resource.
64 65 66 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 64 def found? !nearest_match.nil? end |
#inspect ⇒ String
Returns Human-readable representation.
71 72 73 74 75 76 77 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 71 def inspect '#<ReactorSDK::Resources::UpstreamChain ' \ "resource_id=#{resource_id.inspect} " \ "resource_type=#{resource_type.inspect} " \ "target_library_id=#{target_library_id.inspect} " \ "entries=#{entries.length}>" end |
#nearest_match ⇒ ReactorSDK::Resources::UpstreamChainEntry?
57 58 59 |
# File 'lib/reactor_sdk/resources/upstream_chain.rb', line 57 def nearest_match @entries.find(&:present?) end |