Class: ReVIEW::Book::FormatRef

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

Instance Method Summary collapse

Constructor Details

#initialize(locale, index) ⇒ FormatRef

Returns a new instance of FormatRef.



221
222
223
224
# File 'lib/review/book/index.rb', line 221

def initialize(locale, index)
  @locale = locale
  @index = index
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(mid, *args, &block) ⇒ Object



236
237
238
239
# File 'lib/review/book/index.rb', line 236

def method_missing(mid, *args, &block)
  super unless @index.respond_to?(mid)
  @index.__send__(mid, *args, &block)
end

Instance Method Details

#number(id) ⇒ Object



231
232
233
234
# File 'lib/review/book/index.rb', line 231

def number(id)
  sprintf(@locale["#{@index.item_type}_number_format".intern],
    @index.number(id))
end

#title(id) ⇒ Object



226
227
228
229
# File 'lib/review/book/index.rb', line 226

def title(id)
  sprintf(@locale["#{@index.item_type}_caption_format".intern],
    @index.title(id))
end