Class: BELParser::Language::Semantics::SemanticsResult
- Inherits:
-
Object
- Object
- BELParser::Language::Semantics::SemanticsResult
- Defined in:
- lib/bel_parser/language/semantics_result.rb
Overview
SemanticsResult represents the successful outcome of applying a SemanticsFunction.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#expression_node ⇒ Object
readonly
Returns the value of attribute expression_node.
-
#specification ⇒ Object
readonly
Returns the value of attribute specification.
Instance Method Summary collapse
- #failure? ⇒ Boolean
-
#initialize(expression_node, specification) ⇒ SemanticsResult
constructor
A new instance of SemanticsResult.
- #msg ⇒ Object abstract
- #success? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(expression_node, specification) ⇒ SemanticsResult
Returns a new instance of SemanticsResult.
9 10 11 12 |
# File 'lib/bel_parser/language/semantics_result.rb', line 9 def initialize(expression_node, specification) @expression_node = expression_node @specification = specification end |
Instance Attribute Details
#expression_node ⇒ Object (readonly)
Returns the value of attribute expression_node.
7 8 9 |
# File 'lib/bel_parser/language/semantics_result.rb', line 7 def expression_node @expression_node end |
#specification ⇒ Object (readonly)
Returns the value of attribute specification.
7 8 9 |
# File 'lib/bel_parser/language/semantics_result.rb', line 7 def specification @specification end |
Instance Method Details
#failure? ⇒ Boolean
18 19 20 |
# File 'lib/bel_parser/language/semantics_result.rb', line 18 def failure? false end |
#msg ⇒ Object
This method is abstract.
Subclass and override #msg to provide the message.
23 24 25 |
# File 'lib/bel_parser/language/semantics_result.rb', line 23 def msg "Successful semantic validation of #{@expression_node.type}." end |
#success? ⇒ Boolean
14 15 16 |
# File 'lib/bel_parser/language/semantics_result.rb', line 14 def success? true end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/bel_parser/language/semantics_result.rb', line 27 def to_s "Info: #{msg}" end |