Class: Dmarcurator::Parser::Base
- Inherits:
-
Object
- Object
- Dmarcurator::Parser::Base
- Defined in:
- lib/dmarcurator/parser/base.rb
Overview
Base XML parser
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
Instance Method Summary collapse
-
#initialize(xml: nil, parsed_xml: nil) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(xml: nil, parsed_xml: nil) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/dmarcurator/parser/base.rb', line 11 def initialize(xml: nil, parsed_xml: nil) if xml content = File.read(xml) @doc = Ox.parse(content) elsif parsed_xml @doc = parsed_xml else raise "Either :xml or :parsed_xml are required" end end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
9 10 11 |
# File 'lib/dmarcurator/parser/base.rb', line 9 def doc @doc end |