Class: WellReadFaker::Source

Inherits:
Object
  • Object
show all
Includes:
Mutex_m
Defined in:
lib/well_read_faker/source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path_to_book_or_io, options = {}) ⇒ Source

Returns a new instance of Source.



9
10
11
12
13
# File 'lib/well_read_faker/source.rb', line 9

def initialize path_to_book_or_io, options = {}
  super()
  @path_to_book_or_io = path_to_book_or_io
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/well_read_faker/source.rb', line 7

def options
  @options
end

#path_to_book_or_ioObject (readonly)

Returns the value of attribute path_to_book_or_io.



7
8
9
# File 'lib/well_read_faker/source.rb', line 7

def path_to_book_or_io
  @path_to_book_or_io
end

Instance Method Details

#ensure_loadedObject



20
21
22
# File 'lib/well_read_faker/source.rb', line 20

def ensure_loaded
  @loaded or mu_synchronize{ @loaded or load }
end

#paragraphObject



15
16
17
18
# File 'lib/well_read_faker/source.rb', line 15

def paragraph
  ensure_loaded
  @paragraphs_arr[inc_paragraphs]
end