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.



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

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

Instance Attribute Details

#rawObject (readonly) Also known as: attributes

Returns the value of attribute raw.



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

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

Instance Method Details

#==(other) ⇒ Object



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

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

#inspectObject



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

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

#nameObject



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

def name; '' end