Class: ReVIEW::Book::Index::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/review/book/index/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, number, caption = nil) ⇒ Item

Returns a new instance of Item.



19
20
21
22
23
24
25
# File 'lib/review/book/index/item.rb', line 19

def initialize(id, number, caption = nil)
  @id = id
  @number = number
  @caption = caption
  @path = nil
  @index = nil
end

Instance Attribute Details

#captionObject (readonly) Also known as: content

Returns the value of attribute caption.



29
30
31
# File 'lib/review/book/index/item.rb', line 29

def caption
  @caption
end

#idObject (readonly)

Returns the value of attribute id.



27
28
29
# File 'lib/review/book/index/item.rb', line 27

def id
  @id
end

#indexObject

internal use only



30
31
32
# File 'lib/review/book/index/item.rb', line 30

def index
  @index
end

#numberObject (readonly)

Returns the value of attribute number.



28
29
30
# File 'lib/review/book/index/item.rb', line 28

def number
  @number
end

Instance Method Details

#pathObject



34
35
36
37
38
39
40
41
42
# File 'lib/review/book/index/item.rb', line 34

def path
  if @path
    return @path
  end

  @path = @index.find_path(@id)

  @path
end