Class: Haproxy2Rpm::FileParser
- Inherits:
-
Object
- Object
- Haproxy2Rpm::FileParser
- Includes:
- Enumerable
- Defined in:
- lib/haproxy2rpm/file_parser.rb
Instance Method Summary collapse
- #[](element) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(path) ⇒ FileParser
constructor
A new instance of FileParser.
Constructor Details
#initialize(path) ⇒ FileParser
Returns a new instance of FileParser.
6 7 8 9 10 11 12 |
# File 'lib/haproxy2rpm/file_parser.rb', line 6 def initialize(path) @lines = File.open(path){|f| f.readlines} @records = [] @lines.each do |line| @records << LineParser.new(line) end end |
Instance Method Details
#[](element) ⇒ Object
14 15 16 |
# File 'lib/haproxy2rpm/file_parser.rb', line 14 def [](element) @records end |
#each(&block) ⇒ Object
18 19 20 21 22 |
# File 'lib/haproxy2rpm/file_parser.rb', line 18 def each &block @records.each do |record| yield record end end |