Class: Iev::SourceParser

Inherits:
Object
  • Object
show all
Includes:
Cli::Ui, Utilities
Defined in:
lib/iev/source_parser.rb

Overview

Parses information from the spreadsheet’s SOURCE column.

Examples:

SourceParser.new(cell_data_string).parsed_sources

Constant Summary

Constants included from Utilities

Utilities::FIGURE_ONE_REGEX, Utilities::FIGURE_TWO_REGEX, Utilities::IMAGE_PATH_PREFIX, Utilities::SIMG_PATH_REGEX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#parse_anchor_tag, #replace_newlines

Methods included from Cli::Ui

debug, info, progress, set_ui_tag, warn

Constructor Details

#initialize(source_str, term_domain) ⇒ SourceParser

Returns a new instance of SourceParser.



21
22
23
24
25
26
# File 'lib/iev/source_parser.rb', line 21

def initialize(source_str, term_domain)
  @raw_str = source_str.dup.freeze
  @src_str = raw_str.decode_html.sanitize.freeze
  @term_domain = term_domain
  parse
end

Instance Attribute Details

#parsed_sourcesObject (readonly)

Returns the value of attribute parsed_sources.



19
20
21
# File 'lib/iev/source_parser.rb', line 19

def parsed_sources
  @parsed_sources
end

#raw_strObject (readonly)

Returns the value of attribute raw_str.



19
20
21
# File 'lib/iev/source_parser.rb', line 19

def raw_str
  @raw_str
end

#src_splitObject (readonly)

Returns the value of attribute src_split.



19
20
21
# File 'lib/iev/source_parser.rb', line 19

def src_split
  @src_split
end

#src_strObject (readonly)

Returns the value of attribute src_str.



19
20
21
# File 'lib/iev/source_parser.rb', line 19

def src_str
  @src_str
end