Class: Bukovina::Parsers::IconLink
- Inherits:
-
Object
- Object
- Bukovina::Parsers::IconLink
- Defined in:
- lib/bukovina/parsers/icon_link.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#parse(line) ⇒ Object
вход: значение поля “имя” включая словарь разных языков выход: обработанный словарь данных.
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/bukovina/parsers/icon_link.rb', line 4 def errors @errors end |
Instance Method Details
#parse(line) ⇒ Object
вход: значение поля “имя” включая словарь разных языков выход: обработанный словарь данных
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bukovina/parsers/icon_link.rb', line 11 def parse line # TODO skip return if errors found # res = case line when Array links = line.map do |url| if url.is_a?( Array ) url.map do |u| parse_line( u ) ; end.compact else parse_line( url ) ; end ; end .compact.flatten { icon_link: links } when String { icon_link: [ parse_line( line ) ] } when NilClass else @errors << Parsers::BukovinaInvalidClass.new( "Invalid class " + "#{line.class} for Name line '#{line}'" ) ; end @errors.empty? && res || nil ; end |