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
94
95
96
|
# File 'lib/review/book/index.rb', line 94
def display_string(id)
"#{number(id)}「#{title(id)}」"
end
|
#item_type ⇒ Object
77
78
79
|
# File 'lib/review/book/index.rb', line 77
def item_type
'chapter'
end
|
#number(id) ⇒ Object
81
82
83
84
85
86
|
# File 'lib/review/book/index.rb', line 81
def number(id)
chapter = @index.fetch(id)
chapter.format_number
rescue
"#{I18n.t("part", chapter.number)}"
end
|
#title(id) ⇒ Object
88
89
90
91
92
|
# File 'lib/review/book/index.rb', line 88
def title(id)
@index.fetch(id).title
rescue
@index.fetch(id).name
end
|