class Buoys::Buoy
Attributes
context[R]
previous[R]
Public Class Methods
new(context, key, *args)
click to toggle source
buoy :account do
link 'Account', account_path
end
buoy :account_edit do |account|
link 'Account Show', show_account_path(account) link 'Account Edit', edit_account_path(account) pre_buoy :account
end
# File lib/buoys/buoy.rb, line 15 def initialize(context, key, *args) block = Buoys::Loader.buoys[key] raise ArgumentError, "Buoys :#{key} is not found" unless block @key = key @context = context instance_exec(*args, &block) end
Public Instance Methods
link(key, *args)
click to toggle source
# File lib/buoys/buoy.rb, line 24 def link(key, *args) options = args.extract_options! path = args.shift url = path ? context.url_for(path) : nil text = I18n.t(key, scope: 'buoys.breadcrumbs', default: key) links << Buoys::Link.new(text, url, options) end
links()
click to toggle source
# File lib/buoys/buoy.rb, line 34 def links @links ||= [] end
method_missing(method, *args, &block)
click to toggle source
# File lib/buoys/buoy.rb, line 43 def method_missing(method, *args, &block) context.send(method, *args, &block) end
pre_buoy(key, *args)
click to toggle source
# File lib/buoys/buoy.rb, line 38 def pre_buoy(key, *args) @previous = Buoys::Buoy.new(context, key, *args) end
Also aliased as: parent