Class: Iev::SourceParser

Inherits:
Object
  • Object
show all
Includes:
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::IEV_CODE_RE, Utilities::IMAGE_PATH_PREFIX, Utilities::SIMG_PATH_REGEX

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#parse_anchor_tag, #replace_newlines

Constructor Details

#initialize(source_str, term_domain) ⇒ SourceParser

Returns a new instance of SourceParser.



25
26
27
28
29
30
# File 'lib/iev/source_parser.rb', line 25

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

Class Attribute Details

.relaton_enabledObject

Returns the value of attribute relaton_enabled.



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

def relaton_enabled
  @relaton_enabled
end

Instance Attribute Details

#parsed_sourcesObject (readonly)

Returns the value of attribute parsed_sources.



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

def parsed_sources
  @parsed_sources
end

#raw_strObject (readonly)

Returns the value of attribute raw_str.



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

def raw_str
  @raw_str
end

#src_splitObject (readonly)

Returns the value of attribute src_split.



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

def src_split
  @src_split
end

#src_strObject (readonly)

Returns the value of attribute src_str.



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

def src_str
  @src_str
end