lib/puffer/extensions/mapper.rb in puffer-0.0.9 vs lib/puffer/extensions/mapper.rb in puffer-0.0.10
- old
+ new
@@ -2,25 +2,24 @@
module Extensions
module Mapper
def self.included base
base.class_eval do
- alias_method :original_resource, :resource
- alias_method :original_resources, :resources
-
include InstanceMethods
+ alias_method_chain :resource, :puffer
+ alias_method_chain :resources, :puffer
end
end
module InstanceMethods
- def resource *resources, &block
- puffer_resource(*resources, &block) || original_resource(*resources, &block)
+ def resource_with_puffer *resources, &block
+ puffer_resource(*resources, &block) || resource_without_puffer(*resources, &block)
end
- def resources *resources, &block
- puffer_resources(*resources, &block) || original_resources(*resources, &block)
+ def resources_with_puffer *resources, &block
+ puffer_resources(*resources, &block) || resources_without_puffer(*resources, &block)
end
def puffer_controller controller
puffer = Rails.application.routes.puffer
prefix = @scope[:module]
@@ -154,21 +153,21 @@
module RouteSet
def self.included base
base.class_eval do
- alias_method :original_clear!, :clear!
- attr_accessor_with_default :puffer, {}
-
include InstanceMethods
+
+ alias_method_chain :clear!, :puffer
+ attr_accessor_with_default :puffer, {}
end
end
module InstanceMethods
- def clear!
+ def clear_with_puffer!
self.puffer = {}
- original_clear!
+ clear_without_puffer!
end
end
end