Class: RailsCrumbs::Crumb

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path = nil, options = {}) ⇒ Crumb

Returns a new instance of Crumb.



7
8
9
10
11
# File 'lib/rails_crumbs/crumbs.rb', line 7

def initialize(name, path = nil, options = {})
  self.name     = name
  self.path     = path
  self.options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



15
16
17
18
19
20
21
# File 'lib/rails_crumbs/crumbs.rb', line 15

def method_missing(name, *args)
  if options.has_key? name.to_sym
    options[name.to_sym]
  else
    super(name, *args)
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/rails_crumbs/crumbs.rb', line 3

def name
  @name
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/rails_crumbs/crumbs.rb', line 5

def options
  @options
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/rails_crumbs/crumbs.rb', line 4

def path
  @path
end