Class: EacConfig::NodeUri::InstanciateSingle

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_config/node_uri/instanciate_single.rb

Instance Method Summary collapse

Instance Method Details

#available_node_classesArray<Class>

Returns:

  • (Array<Class>)


11
12
13
14
15
# File 'lib/eac_config/node_uri/instanciate_single.rb', line 11

def available_node_classes
  require 'eac_config/envvars_node'
  require 'eac_config/yaml_file_node'
  [::EacConfig::EnvvarsNode, ::EacConfig::YamlFileNode]
end

#resultEacConfig::Node

Returns:



18
19
20
21
# File 'lib/eac_config/node_uri/instanciate_single.rb', line 18

def result
  available_node_classes.lazy.map { |k| k.from_uri(self) }.find(&:present?) ||
    raise("No class mapped for \"#{to_addressable}\"")
end

#to_addressableAddressable::URI

Returns:

  • (Addressable::URI)


24
25
26
# File 'lib/eac_config/node_uri/instanciate_single.rb', line 24

def to_addressable
  instance_uri.to_uri
end