Class: Bible::BibleRefParser::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/bible/parser.rb

Defined Under Namespace

Classes: MultipleBooks, SingleBook

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



366
367
368
369
370
371
372
# File 'lib/bible/parser.rb', line 366

def method_missing(symbol, *args)
  if @proxy.nil?
    super(symbol, *args)
  else
    @proxy.__send__(symbol, *args)
  end
end

Instance Method Details

#<<(value) ⇒ Object



357
358
359
360
361
362
363
364
# File 'lib/bible/parser.rb', line 357

def <<(value)
  if @proxy.nil?
    @proxy = SingleBook.new(value)
  else
    @proxy = MultipleBooks.new(@proxy) if @proxy.is_a?(SingleBook)
    @proxy << value
  end
end

#has_book?Boolean

Returns:

  • (Boolean)


349
350
351
# File 'lib/bible/parser.rb', line 349

def has_book?
  ! @proxy.nil?
end

#single_book?Boolean

Returns:

  • (Boolean)


353
354
355
# File 'lib/bible/parser.rb', line 353

def single_book?
  self.has_book? && @proxy.is_a?(SingleBook)
end