Module: Environment

Extended by:
Environment
Included in:
Environment
Defined in:
lib/searchbox-tire/environment.rb

Overview

Encapsulates logic for getting environment information.

Instance Method Summary collapse

Instance Method Details

#env_nameObject



5
6
7
8
9
# File 'lib/searchbox-tire/environment.rb', line 5

def env_name
  return Rails.env if defined?(Rails)
  return Sinatra::Base.environment.to_s if defined?(Sinatra)
  ENV["RACK_ENV"] || ENV["SEARCHBOX_ENV"] || raise(Errors::NoEnvironment.new)
end

#load_yaml(path) ⇒ Object



11
12
13
# File 'lib/searchbox-tire/environment.rb', line 11

def load_yaml(path)
  YAML.load(ERB.new(File.new(path).read).result)[env_name]
end