Class: Roundhouse::Script
- Inherits:
-
Wolverine::Script
- Object
- Wolverine::Script
- Roundhouse::Script
- Defined in:
- lib/roundhouse/script.rb
Overview
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
Defined Under Namespace
Classes: Configuration
Instance Method Summary collapse
-
#initialize(content, options = {}) ⇒ Script
constructor
A new instance of Script.
- #instrument(eval_type) ⇒ Object
- #statsd ⇒ Object
Constructor Details
#initialize(content, options = {}) ⇒ Script
Returns a new instance of Script.
10 11 12 13 14 15 |
# File 'lib/roundhouse/script.rb', line 10 def initialize content, = {} @content = content @digest = Digest::SHA1.hexdigest @content @config = [:config] || fail('Must supply a Wolverine::Configuration object') @name = [:name] || @digest end |
Instance Method Details
#instrument(eval_type) ⇒ Object
21 22 23 24 25 26 |
# 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 ⇒ Object
17 18 19 |
# File 'lib/roundhouse/script.rb', line 17 def statsd "Wolverine.#{@name}" end |