Module: Trope::Parser
- Defined in:
- lib/trope/parser.rb,
lib/trope/parser/error.rb
Overview
A controller for the Trope::LanguageParser
Defined Under Namespace
Classes: Error
Class Attribute Summary collapse
-
.tree ⇒ Object
readonly
Set the ‘tree` attribute.
Class Method Summary collapse
-
.instance ⇒ Trope::LanguageParser
Get a new or the cached instance of this class.
-
.parse(data) ⇒ Trope::Language::Body
Set the ‘tree` attribute.
Class Attribute Details
.tree ⇒ Object (readonly)
Set the ‘tree` attribute. This contains the last parsed result.
15 16 17 |
# File 'lib/trope/parser.rb', line 15 def tree @tree end |
Class Method Details
.instance ⇒ Trope::LanguageParser
Get a new or the cached instance of this class.
20 21 22 |
# File 'lib/trope/parser.rb', line 20 def instance @instance ||= LanguageParser.new end |
.parse(data) ⇒ Trope::Language::Body
Set the ‘tree` attribute.
27 28 29 30 31 32 |
# File 'lib/trope/parser.rb', line 27 def parse(data) @tree = instance.parse(data) raise Error, instance unless @tree @tree end |