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.



242
243
244
245
# File 'lib/review/book/index.rb', line 242

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



257
258
259
260
# File 'lib/review/book/index.rb', line 257

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

Instance Method Details

#number(id) ⇒ Object



252
253
254
255
# File 'lib/review/book/index.rb', line 252

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

#title(id) ⇒ Object



247
248
249
250
# File 'lib/review/book/index.rb', line 247

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