Class: BELParser::Language::Semantics::SemanticsResult

Inherits:
Object
  • Object
show all
Defined in:
lib/bel_parser/language/semantics_result.rb

Overview

SemanticsResult represents the successful outcome of applying a SemanticsFunction.

Direct Known Subclasses

SemanticsWarning, SignatureMappingSuccess, Valid

Instance Attribute Summary collapse

Instance Method Summary collapse

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_nodeObject (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

#specificationObject (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

Returns:

  • (Boolean)


18
19
20
# File 'lib/bel_parser/language/semantics_result.rb', line 18

def failure?
  false
end

#msgObject

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

Returns:

  • (Boolean)


14
15
16
# File 'lib/bel_parser/language/semantics_result.rb', line 14

def success?
  true
end

#to_sObject



27
28
29
# File 'lib/bel_parser/language/semantics_result.rb', line 27

def to_s
  "Info: #{msg}"
end