Module: Savage::DirectionProxy::ClassMethods

Defined in:
lib/savage/direction_proxy.rb

Instance Method Summary collapse

Instance Method Details

#define_proxies(&block) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/savage/direction_proxy.rb', line 8

def define_proxies(&block)
  Directions.constants.each do |constant_sym|
    constant = (constant_sym.is_a?(Symbol)) ? constant_sym.to_s : constant_sym
    unless %w[PointTarget CoordinateTarget Point MoveTo].include? constant
      sym = constant.to_s.gsub(/[A-Z]/) { |p| '_' + p.downcase }[1..-1].to_sym
      block.call(sym,constant)
    end
  end
end