class EasyBreadcrumbs::Directory

Directory class makes things easier on the Breadcrumb class.

Attributes

full_path[R]
index[R]
name[R]
resource[R]

Public Class Methods

new(data) click to toggle source
# File lib/easy_breadcrumbs/directory.rb, line 6
def initialize(data)
  @full_path = data.fetch(:full_path)
  @name = data.fetch(:name)
  @resource = data.fetch(:resource)
  @index = data.fetch(:index)
end

Public Instance Methods

edit_view?() click to toggle source
# File lib/easy_breadcrumbs/directory.rb, line 25
def edit_view?
  name == 'edit'
end
ends_in_digit?() click to toggle source
# File lib/easy_breadcrumbs/directory.rb, line 17
def ends_in_digit?
  name =~ %r{\d+\/?$}
end
new_or_edit_view?() click to toggle source
# File lib/easy_breadcrumbs/directory.rb, line 29
def new_or_edit_view?
  new_view? || edit_view?
end
new_view?() click to toggle source
# File lib/easy_breadcrumbs/directory.rb, line 21
def new_view?
  name == 'new'
end
root_path?() click to toggle source
# File lib/easy_breadcrumbs/directory.rb, line 13
def root_path?
  index.zero?
end