Class: Smartdown::Parser::NodeInterpreter
- Inherits:
-
Object
- Object
- Smartdown::Parser::NodeInterpreter
- Defined in:
- lib/smartdown/parser/node_interpreter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(name, source, options = {}) ⇒ NodeInterpreter
constructor
A new instance of NodeInterpreter.
- #interpret ⇒ Object
Constructor Details
#initialize(name, source, options = {}) ⇒ NodeInterpreter
Returns a new instance of NodeInterpreter.
12 13 14 15 16 17 |
# File 'lib/smartdown/parser/node_interpreter.rb', line 12 def initialize(name, source, = {}) @name = name @source = source @parser = .fetch(:parser, Smartdown::Parser::NodeParser.new) @transform = .fetch(:transform, Smartdown::Parser::NodeTransform.new) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/smartdown/parser/node_interpreter.rb', line 10 def name @name end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
10 11 12 |
# File 'lib/smartdown/parser/node_interpreter.rb', line 10 def source @source end |
Instance Method Details
#interpret ⇒ Object
19 20 21 22 23 |
# File 'lib/smartdown/parser/node_interpreter.rb', line 19 def interpret transform.apply(parser.parse(source), node_name: name ) end |