Class: Migajas::Trail::Crumb

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

Overview

Crumbs are dumb values that know their #name, their #url, and whether they match the current URL (according to the ‘env`, which they inherit from their trail).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, url, env) ⇒ Crumb

Returns a new instance of Crumb.



71
72
73
74
75
# File 'lib/migajas.rb', line 71

def initialize(name, url, env)
  @name = name
  @url = url
  @env = env
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



69
70
71
# File 'lib/migajas.rb', line 69

def name
  @name
end

#urlObject (readonly)

Returns the value of attribute url.



69
70
71
# File 'lib/migajas.rb', line 69

def url
  @url
end

Instance Method Details

#current?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/migajas.rb', line 77

def current?
  url == (@env["SCRIPT_NAME"] + @env["PATH_INFO"])
end