Class: ReVIEW::Book::ChapterIndex
Instance Method Summary
collapse
Methods inherited from Index
#[], #each, #has_key?, #initialize, item_class, parse
Instance Method Details
#display_string(id) ⇒ Object
105
106
107
|
# File 'lib/review/book/index.rb', line 105
def display_string(id)
"#{number(id)}#{I18n.t("chapter_quote", title(id))}"
end
|
#item_type ⇒ Object
88
89
90
|
# File 'lib/review/book/index.rb', line 88
def item_type
'chapter'
end
|
#number(id) ⇒ Object
92
93
94
95
96
97
|
# File 'lib/review/book/index.rb', line 92
def number(id)
chapter = @index.fetch(id)
chapter.format_number
rescue
"#{I18n.t("part", chapter.number)}"
end
|
#title(id) ⇒ Object
99
100
101
102
103
|
# File 'lib/review/book/index.rb', line 99
def title(id)
@index.fetch(id).title
rescue
@index.fetch(id).name
end
|