Class: Wordlist::FlatFile
Instance Attribute Summary collapse
-
#path ⇒ Object
The path to the flat-file.
Attributes inherited from List
Instance Method Summary collapse
-
#each_word {|word| ... } ⇒ Object
Enumerates through every word in the flat-file.
-
#initialize(path, options = {}, &block) ⇒ FlatFile
constructor
Opens a new FlatFile list.
Methods inherited from List
#each_mutation, #each_unique, #mutate
Constructor Details
#initialize(path, options = {}, &block) ⇒ FlatFile
Opens a new FlatFile list.
18 19 20 21 22 |
# File 'lib/wordlist/flat_file.rb', line 18 def initialize(path,={},&block) @path = path super(,&block) end |
Instance Attribute Details
#path ⇒ Object
The path to the flat-file
7 8 9 |
# File 'lib/wordlist/flat_file.rb', line 7 def path @path end |
Instance Method Details
#each_word {|word| ... } ⇒ Object
Enumerates through every word in the flat-file.
38 39 40 41 42 43 44 |
# File 'lib/wordlist/flat_file.rb', line 38 def each_word(&block) File.open(@path) do |file| file.each_line do |line| yield line.chomp end end end |