Class: GenesisRuby::Parsers::Base
- Inherits:
-
Object
- Object
- GenesisRuby::Parsers::Base
- Defined in:
- lib/genesis_ruby/parsers/base.rb
Overview
Contract for every parser abstraction
Instance Attribute Summary collapse
-
#root_node_skipped ⇒ Object
readonly
Returns the value of attribute root_node_skipped.
-
#structure ⇒ Object
readonly
Returns the value of attribute structure.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
-
#parse_document(document) ⇒ Object
Parse given document to Hash Structuce.
-
#skip_root_node ⇒ Object
Indicates that the Root element will not be included in the generated Object.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
10 11 12 13 |
# File 'lib/genesis_ruby/parsers/base.rb', line 10 def initialize @structure = {} @root_node_skipped = false end |
Instance Attribute Details
#root_node_skipped ⇒ Object (readonly)
Returns the value of attribute root_node_skipped.
8 9 10 |
# File 'lib/genesis_ruby/parsers/base.rb', line 8 def root_node_skipped @root_node_skipped end |
#structure ⇒ Object (readonly)
Returns the value of attribute structure.
8 9 10 |
# File 'lib/genesis_ruby/parsers/base.rb', line 8 def structure @structure end |
Instance Method Details
#parse_document(document) ⇒ Object
Parse given document to Hash Structuce
16 17 18 |
# File 'lib/genesis_ruby/parsers/base.rb', line 16 def parse_document(document) raise NotImplementedError, 'Parse Document must be implemented' end |
#skip_root_node ⇒ Object
Indicates that the Root element will not be included in the generated Object
21 22 23 |
# File 'lib/genesis_ruby/parsers/base.rb', line 21 def skip_root_node @root_node_skipped = true end |