class Forkforge::Handler

Public Class Methods

new(handler_class, *args) click to toggle source
# File lib/forkforge/dsl/handler.rb, line 5
def initialize handler_class, *args
  @handler = handler_class.split('::').inject(Object) do |mod, clazz|
    mod.const_get(clazz)
  end.new *args

  @delayed = []
end

Public Instance Methods

method_missing(method, *args, &block) click to toggle source
# File lib/forkforge/dsl/handler.rb, line 13
def method_missing method, *args, &block
  if @handler.respond_to? method
    @handler.send(method, *args, &block)
    @delayed.clear
  else
    @delayed.unshift "#{method}"
  end
end
parse(input) click to toggle source
# File lib/forkforge/dsl/handler.rb, line 22
def parse input
  self.instance_eval %Q{
    #{File.read input}
  }
end