Class: Endeca::Breadcrumb

Inherits:
Object show all
Includes:
Readers
Defined in:
lib/endeca/breadcrumb.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Readers

included

Constructor Details

#initialize(raw = {}) ⇒ Breadcrumb

Returns a new instance of Breadcrumb.



25
26
27
# File 'lib/endeca/breadcrumb.rb', line 25

def initialize(raw={})
  @raw = raw
end

Instance Attribute Details

#rawObject (readonly) Also known as: attributes

Returns the value of attribute raw.



24
25
26
# File 'lib/endeca/breadcrumb.rb', line 24

def raw
  @raw
end

Class Method Details

.create(raw) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/endeca/breadcrumb.rb', line 6

def self.create(raw)
  name = raw['Type']
  breadcrumb_class = self

  if name    
    unless Breadcrumbs.include?(name)
      raise Breadcrumbs::TypeError, "Unknown breadcrumb type: #{name.inspect}" 
    end
    breadcrumb_class = Breadcrumbs[name]
  end

  breadcrumb_class.new(raw)
end

.to_procObject



20
21
22
# File 'lib/endeca/breadcrumb.rb', line 20

def self.to_proc
  proc(&method(:create))
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
# File 'lib/endeca/breadcrumb.rb', line 33

def ==(other)
  name == other.name
end

#inspectObject



37
38
39
# File 'lib/endeca/breadcrumb.rb', line 37

def inspect
  "#<#{self.class}=0x#{self.object_id.to_s(16)} name=#{name.inspect}>"
end

#nameObject



31
# File 'lib/endeca/breadcrumb.rb', line 31

def name; '' end