class ResponseMatcher::ParseSchema

Attributes

objects[R]
response[R]
schema_path[R]

Public Class Methods

new(schema_path, objects = {}) click to toggle source
Calls superclass method
# File lib/response_matcher/parse_schema.rb, line 3
def self.new(schema_path, objects = {})
  Settings.config.helpers.each { |helper| include helper }
  attr_accessor(*objects.keys)

  super(schema_path, objects)
end
new(schema_path, objects) click to toggle source
# File lib/response_matcher/parse_schema.rb, line 12
def initialize(schema_path, objects)
  @schema_path = schema_path
  @objects = objects

  initialize_objects
  render_schema
end

Public Instance Methods

call(schema_path, objects = {}) click to toggle source
# File lib/response_matcher/parse_schema.rb, line 20
def call(schema_path, objects = {})
  self.class.new(schema_path, objects).response
end

Private Instance Methods

initialize_objects() click to toggle source
# File lib/response_matcher/parse_schema.rb, line 26
def initialize_objects
  objects.each do |name, value|
    instance_variable_set "@#{name}", value
  end
end
render_schema() click to toggle source
# File lib/response_matcher/parse_schema.rb, line 32
def render_schema
  path = File.absolute_path("#{Settings.config.directory}/#{schema_path}.rb")
  @response = eval(File.read(path))
end