class Heroku::Kensa::Check
Attributes
data[RW]
screen[RW]
Public Class Methods
new(data, screen=NilScreen.new)
click to toggle source
# File lib/heroku/kensa/check.rb, line 14 def initialize(data, screen=NilScreen.new) @data = data @screen = screen end
Public Instance Methods
call()
click to toggle source
# File lib/heroku/kensa/check.rb, line 45 def call call! true rescue CheckError => boom screen.result(false) screen.error boom.message if boom.message != boom.class.name false end
check(msg) { || ... }
click to toggle source
# File lib/heroku/kensa/check.rb, line 27 def check(msg) screen.check(msg) if yield screen.result(true) else raise CheckError end end
env()
click to toggle source
# File lib/heroku/kensa/check.rb, line 19 def env @data.fetch(:env, 'test') end
error(msg)
click to toggle source
# File lib/heroku/kensa/check.rb, line 41 def error(msg) raise CheckError, msg end
run(klass, data)
click to toggle source
# File lib/heroku/kensa/check.rb, line 36 def run(klass, data) c = klass.new(data, screen) instance_eval(&c) end
test(msg)
click to toggle source
# File lib/heroku/kensa/check.rb, line 23 def test(msg) screen.test msg end
to_proc()
click to toggle source
# File lib/heroku/kensa/check.rb, line 55 def to_proc me = self Proc.new { me.call! } end
url()
click to toggle source
# File lib/heroku/kensa/check.rb, line 60 def url if data['api'][env].is_a? Hash base = data['api'][env]['base_url'] uri = URI.parse(base) uri.query = nil uri.path = '' uri.to_s else data['api'][env].chomp("/") end end