lib/gretel/crumb.rb in gretel-4.0.2 vs lib/gretel/crumb.rb in gretel-4.1.0

- old
+ new

@@ -1,5 +1,7 @@ +require 'gretel/link' + module Gretel class Crumb # Initializes a new crumb from the given +key+. # It finds the breadcrumb created in +Gretel::Crumbs.layout+ and renders the block using the arguments supplied in +args+. def initialize(context, key, *args) @@ -11,11 +13,11 @@ block = Gretel::Crumbs.crumbs[key] raise ArgumentError, "Breadcrumb :#{key} not found." unless block @key = key @context = context - instance_exec *args, &block + instance_exec(*args, &block) end # Sets link of the breadcrumb. # You can supply an optional options hash that will be available on the links # so you can pass info when rendering the breadcrumbs manually. @@ -27,11 +29,11 @@ options = args.extract_options! text, url = args # Transform objects to real paths. url = url_for(url) if url - + links << Gretel::Link.new(key, text, url, options) end # Holds all of the breadcrumb's links as a breadcrumb can have multiple links. def links @@ -62,7 +64,8 @@ # Proxy to view context. def method_missing(method, *args, &block) context.send(method, *args, &block) end + ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true) end end