Class: Escort::Setup::Configuration::Locator::Chaining

Inherits:
Base
  • Object
show all
Defined in:
lib/escort/setup/configuration/locator/chaining.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#filename

Instance Method Summary collapse

Constructor Details

#initialize(filename, locators = []) ⇒ Chaining

Returns a new instance of Chaining.



8
9
10
11
# File 'lib/escort/setup/configuration/locator/chaining.rb', line 8

def initialize(filename, locators = [])
  super(filename)
  @locators = locators || []
end

Instance Attribute Details

#locatorsObject (readonly)

Returns the value of attribute locators.



6
7
8
# File 'lib/escort/setup/configuration/locator/chaining.rb', line 6

def locators
  @locators
end

Instance Method Details

#add_locator(locator) ⇒ Object



21
22
23
24
# File 'lib/escort/setup/configuration/locator/chaining.rb', line 21

def add_locator(locator)
  @locators << locator
  self
end

#locateObject



13
14
15
16
17
18
19
# File 'lib/escort/setup/configuration/locator/chaining.rb', line 13

def locate
  locators.each do |locator|
    filepath = locator.locate
    return filepath if filepath
  end
  nil
end