Class: Jerakia::Datasource

Inherits:
Object
  • Object
show all
Defined in:
lib/jerakia/datasource.rb,
lib/jerakia/datasource/file/json.rb,
lib/jerakia/datasource/file/yaml.rb

Defined Under Namespace

Classes: Consul_kv, Dummy, File, Http, Instance

Class Method Summary collapse

Class Method Details

.class_of(name) ⇒ Object


89
90
91
# File 'lib/jerakia/datasource.rb', line 89

def self.class_of(name)
  return eval "Jerakia::Datasource::#{name.to_s.capitalize}"
end

.load_datasource(name) ⇒ Object


85
86
87
# File 'lib/jerakia/datasource.rb', line 85

def self.load_datasource(name)
  require "jerakia/datasource/#{name.to_s}"
end

.run(lookup) ⇒ Object


94
95
96
97
98
99
# File 'lib/jerakia/datasource.rb', line 94

def self.run(lookup)
  options  = lookup.datasource[:opts]
  datasource = class_of(lookup.datasource[:name]).new(lookup, options)
  datasource.lookup
  return datasource.response
end