Class: Fyodor::ClippingsParser
- Inherits:
-
Object
- Object
- Fyodor::ClippingsParser
- Defined in:
- lib/fyodor/clippings_parser.rb
Constant Summary collapse
- SEPARATOR =
/^==========\r?\n$/
Instance Method Summary collapse
-
#initialize(clippings_path, parser_config) ⇒ ClippingsParser
constructor
A new instance of ClippingsParser.
- #parse(library) ⇒ Object
Constructor Details
#initialize(clippings_path, parser_config) ⇒ ClippingsParser
Returns a new instance of ClippingsParser.
7 8 9 10 |
# File 'lib/fyodor/clippings_parser.rb', line 7 def initialize(clippings_path, parser_config) @path = clippings_path @config = parser_config end |
Instance Method Details
#parse(library) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fyodor/clippings_parser.rb', line 12 def parse(library) lines = [] File.open(@path).each do |line| lines << line if end_entry?(lines) library << parse_entry(lines) lines.clear end end raise "MyClippings is badly formatted" if lines.size > 0 end |