Class: Pipely::ReferenceList

Inherits:
Object
  • Object
show all
Defined in:
lib/pipely/reference_list.rb

Overview

A list of references to Components for managing dependencies

Instance Method Summary collapse

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

Returns:

  • (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(options={}, depth=0)
  if 1 == @raw_references.count
    @raw_references.first.to_json(options)
  else
    @raw_references.to_json(options)
  end
end