class ResponseMate::Environment

Responsible for parsing the environment file The environment file (by default found as environment.yml in a project) is a Hash which will be used for the rendering of the requests manifest as a [Mustace template](mustache.github.io/mustache.5.html).

Attributes

env[RW]
filename[RW]

Public Class Methods

new(filename) click to toggle source
# File lib/response_mate/environment.rb, line 10
def initialize(filename)
  @filename = filename || ResponseMate.configuration.environment
  parse
end

Public Instance Methods

exists?() click to toggle source

Check for environment file existence @return [TrueClass|FalseClass]

# File lib/response_mate/environment.rb, line 17
def exists?
  File.exist? filename
end

Private Instance Methods

parse() click to toggle source

Set the env to the parsed YAML environment file

# File lib/response_mate/environment.rb, line 24
def parse
  return @env = {} unless exists?
  @env = ::YAML.load_file(filename)
end