class ApiSpec::State

Public Class Methods

get(key) click to toggle source
# File lib/api_spec/state.rb, line 8
def get(key)
  state[key.to_sym] || call_helper(key)
end
register_helper(key, &block) click to toggle source
# File lib/api_spec/state.rb, line 12
def register_helper(key, &block)
  helpers[key.to_sym] = block
end
reset() click to toggle source
# File lib/api_spec/state.rb, line 16
def reset
  @state = {}
end
set(key, value) click to toggle source
# File lib/api_spec/state.rb, line 4
def set(key, value)
  state[key.to_sym] = value
end

Private Class Methods

call_helper(key) click to toggle source
# File lib/api_spec/state.rb, line 22
def call_helper(key)
  if helpers[key.to_sym]
    helpers[key.to_sym].call
  else
    nil
  end
end
helpers() click to toggle source
# File lib/api_spec/state.rb, line 34
def helpers
  @helpers ||= {}
end
state() click to toggle source
# File lib/api_spec/state.rb, line 30
def state
  @state ||= {}
end