Class: Shoppe::NavigationManager::NavigationItem

Inherits:
Object
  • Object
show all
Defined in:
lib/shoppe/navigation_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#active_ifObject

Returns the value of attribute active_if.



55
56
57
# File 'lib/shoppe/navigation_manager.rb', line 55

def active_if
  @active_if
end

#identifierObject

Returns the value of attribute identifier.



52
53
54
# File 'lib/shoppe/navigation_manager.rb', line 52

def identifier
  @identifier
end

Returns the value of attribute link_options.



54
55
56
# File 'lib/shoppe/navigation_manager.rb', line 54

def link_options
  @link_options
end

#managerObject

Returns the value of attribute manager.



51
52
53
# File 'lib/shoppe/navigation_manager.rb', line 51

def manager
  @manager
end

#url(request = nil) ⇒ Object

Returns the value of attribute url.



53
54
55
# File 'lib/shoppe/navigation_manager.rb', line 53

def url
  @url
end

Instance Method Details

#active?(request) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
70
71
72
73
# File 'lib/shoppe/navigation_manager.rb', line 67

def active?(request)
  if active_if.is_a?(Proc)
    request.instance_eval(&active_if) == true
  elsif active_nav_var = request.instance_variable_get('@active_nav')
    active_nav_var.to_s == identifier
  end
end

#descriptionObject



57
58
59
# File 'lib/shoppe/navigation_manager.rb', line 57

def description
  I18n.translate("shoppe.navigation.#{manager.identifier}.#{identifier}")
end