class Crew::Context::DSL
Public Class Methods
new(context, &blk)
click to toggle source
# File lib/crew/context/dsl.rb, line 4 def initialize(context, &blk) @context = context end
Public Instance Methods
adapter(name_or_module, opts = {})
click to toggle source
# File lib/crew/context/dsl.rb, line 18 def adapter(name_or_module, opts = {}) @context.adapter_name = name_or_module.to_s @context.extend name_or_module.is_a?(Module) ? name_or_module : Context.const_get(name_or_module.to_s) @context.opts = opts end
hint(hint)
click to toggle source
# File lib/crew/context/dsl.rb, line 24 def hint(hint) @context.hints << hint end
load(file = nil, &blk)
click to toggle source
# File lib/crew/context/dsl.rb, line 8 def load(file = nil, &blk) if file instance_eval File.read(file), file, 1 @context.source = file elsif blk instance_eval(&blk) @context.source = blk.source_location.join(":") end end