Class: Pipely::ReferenceList
- Inherits:
-
Object
- Object
- Pipely::ReferenceList
- Defined in:
- lib/pipely/reference_list.rb
Overview
A list of references to Components for managing dependencies
Instance Method Summary collapse
- #build_dependencies(label) ⇒ Object
-
#initialize(input) ⇒ ReferenceList
constructor
A new instance of ReferenceList.
- #present? ⇒ Boolean
- #to_json(options = {}, depth = 0) ⇒ Object
Constructor Details
#initialize(input) ⇒ ReferenceList
Returns a new instance of ReferenceList.
9 10 11 |
# File 'lib/pipely/reference_list.rb', line 9 def initialize(input) @raw_references = [input].flatten.compact end |
Instance Method Details
#build_dependencies(label) ⇒ Object
13 14 15 |
# File 'lib/pipely/reference_list.rb', line 13 def build_dependencies(label) @raw_references.map{|h| Dependency.new(label, h['ref'])} end |
#present? ⇒ Boolean
25 26 27 |
# File 'lib/pipely/reference_list.rb', line 25 def present? !@raw_references.empty? end |
#to_json(options = {}, depth = 0) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/pipely/reference_list.rb', line 17 def to_json(={}, depth=0) if 1 == @raw_references.count @raw_references.first.to_json() else @raw_references.to_json() end end |