lib/crumpet/crumb.rb in crumpet-0.1.1 vs lib/crumpet/crumb.rb in crumpet-0.1.2

- old
+ new

@@ -1,49 +1,13 @@ module Crumpet class Crumb - attr_reader :name, :url, :options + attr_reader :name, :url, :options, :item_options, :wrapper_options def initialize(name, *args) @options = args.extract_options! + @item_options = @options.delete(:item_options) || {} + @wrapper_options = @options.delete(:wrapper_options) || {} @name = name @url = args.first - end - - def link? - url.present? && option_or_default(:link).present? - end - - def escape? - option_or_default(:escape) - end - - def truncate? - truncate.present? - end - - def truncate - option_or_default(:truncate) - end - - def wrap? - wrapper.present? - end - - def wrapper - option_or_default(:wrapper) - end - - def item_options - options.fetch(:item_options, {}) - end - - def wrapper_options - options.fetch(:wrapper_options, {}) - end - - private - - def option_or_default(option) - options.fetch(option, Crumpet.config.send(option.to_sym).clone) end end end