lib/rep.rb in rep-0.0.4 vs lib/rep.rb in rep-0.1.0

- old
+ new

@@ -35,39 +35,22 @@ def self.included(klass) klass.extend Forwardable klass.extend ClassMethods klass.instance_eval { - # Translate for ActiveSupport, the jerk - if method(:delegate).arity == -1 - class << self - def delegate(opts = {}) - methods, object_name = opts.to_a.first - args = methods.concat([:to => object_name]) - super(*args) - end - end - end - class << self - unless defined?(delegate) - def delegate(opts = {}) - methods, object_name = opts.to_a.first - args = [object_name, methods].flatten - def_delegators *args - end + unless defined?(forward) + alias forward delegate end - alias forward delegate - unless defined?(fields) alias fields json_fields end + end - if defined?(Hashie) - include HashieSupport - end + if defined?(Mashed) + include MashedSupport end } end # Since a goal is to be able to share instances, we need an easy way to reset a @@ -315,11 +298,11 @@ shared(opts).to_hash } end end - module HashieSupport + module MashedSupport def to_hash(name = :default) - Hashie::Mash.new(super) + Mashed::Mash.new(super) end end end