class JsonReducer::Schemas

Attributes

base_path[RW]

Public Class Methods

new() click to toggle source
# File lib/json_reducer/schemas.rb, line 10
def initialize
  @schemas = {}
  @base_path = nil
end

Public Instance Methods

get(key) click to toggle source
# File lib/json_reducer/schemas.rb, line 15
def get(key)
  @schemas[key]
end
set(key, schema, file) click to toggle source
# File lib/json_reducer/schemas.rb, line 19
def set(key, schema, file)
  value = file ? File.read("#{@base_path}/#{schema}") : schema
  @schemas[key] = value.is_a?(String) ? JSON.parse(value) : value
end