class Navigatrix::Item

Public Instance Methods

active?() click to toggle source
# File lib/navigatrix/item.rb, line 11
def active?
  applicable_active_state? ||
  active_children? ||
  unlinked?
end
children() click to toggle source
# File lib/navigatrix/item.rb, line 29
def children
  @children ||= ItemCollection.new(config.children, context).items
end
has_children?() click to toggle source
# File lib/navigatrix/item.rb, line 25
def has_children?
  children.any?
end
linked?() click to toggle source
# File lib/navigatrix/item.rb, line 17
def linked?
  !unlinked?
end
path() click to toggle source
# File lib/navigatrix/item.rb, line 33
def path
  @path ||= Path.new(config.path).call(context).to_s
end
unlinked?() click to toggle source
# File lib/navigatrix/item.rb, line 21
def unlinked?
  unlinked_states_specified? ? unlinked_states.any?(&:applicable?) : currently_on_path?
end

Private Instance Methods

active_children?() click to toggle source
# File lib/navigatrix/item.rb, line 39
def active_children?
  children.any?(&:active?)
end
active_states() click to toggle source
# File lib/navigatrix/item.rb, line 55
def active_states
  @active_states ||= config.active_states.map { |active_state| State.new(active_state, context) }
end
applicable_active_state?() click to toggle source
# File lib/navigatrix/item.rb, line 43
def applicable_active_state?
  active_states.any?(&:applicable?)
end
config() click to toggle source
Calls superclass method
# File lib/navigatrix/item.rb, line 63
def config
  @config ||= Configuration.wrap(super)
end
currently_on_path?() click to toggle source
# File lib/navigatrix/item.rb, line 47
def currently_on_path?
  current_path == path.split('#').first
end
unlinked_states() click to toggle source
# File lib/navigatrix/item.rb, line 59
def unlinked_states
  @unlinked_states ||= config.unlinked_states.map { |unlinked_state| State.new(unlinked_state, context) }
end
unlinked_states_specified?() click to toggle source
# File lib/navigatrix/item.rb, line 51
def unlinked_states_specified?
  unlinked_states.any?
end