Sha256: b7f59175180c5ed9b6a9bd2daa01fc63f776b61c525b89480bb2de23bc7730f6

Contents?: true

Size: 551 Bytes

Versions: 6

Compression:

Stored size: 551 Bytes

Contents

module HasBreadcrumb
  module ClassMethods
    def has_breadcrumb options = {}
      define_method :breadcrumb_parent do
        return nil if options[:parent].nil?
        self.send(options[:parent])
      end

      define_method :breadcrumb_name do
        return "" if options[:title].nil?
        case options[:title].class.name
          when "Symbol"
            self.send(options[:title])
          else
            options[:title]
        end
      end
    end
  end

  def self.included(receiver)
    receiver.extend  ClassMethods
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_breadcrumbs-1.1.0 lib/has_breadcrumb/has_breadcrumb.rb
simple_breadcrumbs-1.0.5 lib/has_breadcrumb/has_breadcrumb.rb
simple_breadcrumbs-1.0.4 lib/has_breadcrumb/has_breadcrumb.rb
simple_breadcrumbs-0.0.4 lib/has_breadcrumb/has_breadcrumb.rb
simple_breadcrumbs-0.0.2 lib/has_breadcrumb/has_breadcrumb.rb
simple_breadcrumbs-0.0.1 lib/has_breadcrumb/has_breadcrumb.rb