Class: Bukovina::Parsers::PlainService
- Inherits:
-
Object
- Object
- Bukovina::Parsers::PlainService
- Defined in:
- lib/bukovina/parsers/plain_service.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize ⇒ PlainService
constructor
A new instance of PlainService.
- #parse(line) ⇒ Object
Constructor Details
#initialize ⇒ PlainService
Returns a new instance of PlainService.
16 17 |
# File 'lib/bukovina/parsers/plain_service.rb', line 16 def initialize @errors = [] ; end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
2 3 4 |
# File 'lib/bukovina/parsers/plain_service.rb', line 2 def errors @errors end |
Instance Method Details
#parse(line) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/bukovina/parsers/plain_service.rb', line 6 def parse line res = if line.is_a?( String ) { text: line } else @errors << Parsers::BukovinaInvalidClass.new( "Invalid class " + "#{line.class} for Name line '#{line}'" ) ; end @errors.empty? && res || nil ; end |