Class: ReVIEW::Book::ChapterIndex
Instance Method Summary
collapse
Methods inherited from Index
#[], #each, #initialize, item_class, #key?, parse
Instance Method Details
#display_string(id) ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/review/book/index.rb', line 110
def display_string(id)
if number(id)
I18n.t('chapter_quote', [number(id), title(id)])
else
I18n.t('chapter_quote_without_number', title(id))
end
end
|
#item_type ⇒ Object
91
92
93
|
# File 'lib/review/book/index.rb', line 91
def item_type
'chapter'
end
|
#number(id) ⇒ Object
95
96
97
98
99
100
101
102
|
# File 'lib/review/book/index.rb', line 95
def number(id)
chapter = @index.fetch(id)
begin
chapter.format_number
rescue I18n.t('part', chapter.number)
end
end
|
#title(id) ⇒ Object
104
105
106
107
108
|
# File 'lib/review/book/index.rb', line 104
def title(id)
@index.fetch(id).title
rescue @index.fetch(id).name
end
|