Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding support for AR 3.0.0 and ruby 1.9.2

  • Loading branch information...
commit 6a0e94bfefd67c6e4a54ee9aa16dbaef2c006690 1 parent c53f0c9
@awebneck authored
Showing with 12 additions and 7 deletions.
  1. +5 −1 lib/savage.rb
  2. +7 −6 lib/savage/direction_proxy.rb
View
6 lib/savage.rb
@@ -1,4 +1,8 @@
-require 'activesupport'
+begin
+ require 'active_support/core_ext/string/inflections'
+rescue LoadError, NameError
+ require 'activesupport'
+end
SAVAGE_PATH = File.dirname(__FILE__) + "/savage/"
[
'utils',
View
13 lib/savage/direction_proxy.rb
@@ -1,18 +1,19 @@
module Savage
module DirectionProxy
- def self.included(klass)
- klass.extend ClassMethods
+ def self.included(klass)
+ klass.extend ClassMethods
end
-
+
module ClassMethods
def define_proxies(&block)
- Directions.constants.each do |constant|
+ 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.gsub(/[A-Z]/) { |p| '_' + p.downcase }[1..-1].to_sym
+ sym = constant.to_s.gsub(/[A-Z]/) { |p| '_' + p.downcase }[1..-1].to_sym
block.call(sym,constant)
end
end
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.