Class: NokogiriNotepad::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/nokogiri-notepad/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, single_targets, multiple_targets, extensions = nil) ⇒ Parser

Returns a new instance of Parser.



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nokogiri-notepad/parser.rb', line 11

def initialize(file_path, single_targets, multiple_targets, extensions = nil)
  @file_path = file_path
  @single_targets = single_targets
  @multiple_targets = multiple_targets
  @accepted_extensions = [".xml"]
  add_extensions(extensions) if extensions
  validate_input
  doc = load_nokogiri_doc file_path
  @node_finder = NodeFinder.new doc
  initialize_data
  doc = nil
  @node_finder = nil
end

Instance Attribute Details

#accepted_extensionsObject

Returns the value of attribute accepted_extensions.



8
9
10
# File 'lib/nokogiri-notepad/parser.rb', line 8

def accepted_extensions
  @accepted_extensions
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



9
10
11
# File 'lib/nokogiri-notepad/parser.rb', line 9

def file_path
  @file_path
end

#multiple_targetsObject (readonly)

Returns the value of attribute multiple_targets.



9
10
11
# File 'lib/nokogiri-notepad/parser.rb', line 9

def multiple_targets
  @multiple_targets
end

#single_targetsObject (readonly)

Returns the value of attribute single_targets.



9
10
11
# File 'lib/nokogiri-notepad/parser.rb', line 9

def single_targets
  @single_targets
end

Instance Method Details

#extensionsObject



25
26
27
# File 'lib/nokogiri-notepad/parser.rb', line 25

def extensions
  @accepted_extensions
end