class Roundhouse::Script

Modifies the Shopify Wolverine library. The Roundhouse::Script will take a string and load it up to redis directly. No method-missing, no autoloading, no templating. Optionally pass a :name, so we can collect stats. Otherwise it will be the SHA1 hash

Public Class Methods

new(content, options = {}) click to toggle source
# File lib/roundhouse/script.rb, line 10
def initialize content, options = {}
  @content = content
  @digest  = Digest::SHA1.hexdigest @content
  @config  = options[:config] || fail('Must supply a Wolverine::Configuration object')
  @name    = options[:name] || @digest
end

Public Instance Methods

instrument(eval_type) { || ... } click to toggle source
# File lib/roundhouse/script.rb, line 21
def instrument eval_type
  ret = nil
  runtime = Benchmark.realtime { ret = yield }
  @config.instrumentation.call @name, runtime, eval_type
  ret
end
statsd() click to toggle source
# File lib/roundhouse/script.rb, line 17
def statsd
  "Wolverine.#{@name}"
end