module Dogy

Constants

VERSION

Public Class Methods

eat(args,location) click to toggle source
# File lib/dogy/dogylib.rb, line 23
def self.eat(args,location)
  result = []
  parse(args,location).each do |m|
    m[:args].map!{|v| eval(v)}
    result << m[:method].call(*m[:args])
  end
  result
end
parse(args,location) click to toggle source
# File lib/dogy/dogylib.rb, line 3
def self.parse(args,location)
  list = []
  m = nil
  args.each do |arg|
    if location.private_methods.include?(arg.to_sym)
      method = location.method(arg.to_sym)
      m = {
        :method => method,
        :size => method.parameters.length,
        :args => []
      }
      list << m
    elsif m
      m[:args] << arg if m[:args].length < m[:size]
    end
  end
  list
end