Class: ULS::DatFile
- Inherits:
-
Object
- Object
- ULS::DatFile
- Defined in:
- lib/uls/dat_file.rb
Overview
Used to interact with the FCC DAT file.
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #each_line(&_block) ⇒ Object
- #each_record(&_block) ⇒ Object
-
#initialize(path) ⇒ DatFile
constructor
A new instance of DatFile.
Constructor Details
#initialize(path) ⇒ DatFile
Returns a new instance of DatFile.
6 7 8 |
# File 'lib/uls/dat_file.rb', line 6 def initialize(path) self.path = path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/uls/dat_file.rb', line 4 def path @path end |
Instance Method Details
#each_line(&_block) ⇒ Object
10 11 12 13 14 |
# File 'lib/uls/dat_file.rb', line 10 def each_line(&_block) return unless File.exist?(path) File.foreach(path) { |line| yield(line) } end |
#each_record(&_block) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/uls/dat_file.rb', line 16 def each_record(&_block) return unless File.exist?(path) File.foreach(path) do |line| record = line_to_record(line) yield(record) end end |