Class: BELParser::Language::ExpressionValidator::TermResult
- Inherits:
-
Object
- Object
- BELParser::Language::ExpressionValidator::TermResult
- Includes:
- Result
- Defined in:
- lib/bel_parser/language/expression_validator.rb
Instance Attribute Summary collapse
-
#semantics_results ⇒ Object
readonly
Returns the value of attribute semantics_results.
-
#syntax_results ⇒ Object
readonly
Returns the value of attribute syntax_results.
Instance Method Summary collapse
- #detail ⇒ Object
-
#initialize(syntax_results, semantics_results) ⇒ TermResult
constructor
A new instance of TermResult.
- #valid_semantics? ⇒ Boolean
Methods included from Result
#invalid_signature_mappings, #to_s, #valid?, #valid_signature_mappings, #valid_syntax?
Constructor Details
#initialize(syntax_results, semantics_results) ⇒ TermResult
156 157 158 159 |
# File 'lib/bel_parser/language/expression_validator.rb', line 156 def initialize(syntax_results, semantics_results) @syntax_results = syntax_results @semantics_results = semantics_results end |
Instance Attribute Details
#semantics_results ⇒ Object (readonly)
Returns the value of attribute semantics_results.
153 154 155 |
# File 'lib/bel_parser/language/expression_validator.rb', line 153 def semantics_results @semantics_results end |
#syntax_results ⇒ Object (readonly)
Returns the value of attribute syntax_results.
153 154 155 |
# File 'lib/bel_parser/language/expression_validator.rb', line 153 def syntax_results @syntax_results end |
Instance Method Details
#detail ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/bel_parser/language/expression_validator.rb', line 167 def detail report = "Valid signatures\n" valid_signature_mappings.each do |mapping| report += " #{mapping.signature}\n" mapping.results.each do |reason| report += " #{reason}\n" end end report += "\n" report += "Invalid signatures\n" invalid_signature_mappings.each do |mapping| report += " #{mapping.signature}\n" mapping.results.each do |reason| report += " #{reason}\n" end end report end |
#valid_semantics? ⇒ Boolean
161 162 163 164 165 |
# File 'lib/bel_parser/language/expression_validator.rb', line 161 def valid_semantics? @semantics_results.any? do |res| res.is_a?(Semantics::SignatureMappingSuccess) end end |