lib/crumpet/controller_additions.rb in crumpet-0.2.1 vs lib/crumpet/controller_additions.rb in crumpet-0.3.0
- old
+ new
@@ -3,20 +3,19 @@
def self.included(base)
base.extend ClassMethods
end
def add_crumb(*args)
- Crumpet.crumbs.add_crumb(*args)
+ crumbs.add_crumb(*args)
end
def clear_crumbs
- Crumpet.crumbs.clear
+ crumbs.clear
end
def crumbs(&block)
- yield if block_given?
- Crumpet.crumbs
+ @_crumbs ||= Crumpet::Repository.new
end
module ClassMethods
def crumbs(&block)
crumbs_for(&block)
@@ -24,13 +23,12 @@
def crumbs_for(*args, &block)
if block_given?
options = args.present? ? { only: args } : {}
before_action(options) do |instance|
- instance.instance_exec(:crumbs, &block)
+ instance.instance_exec(&block)
end
end
- Crumpet.crumbs
end
end
end
end