Class: Yoda::Services::CurrentNodeExplain
- Inherits:
-
Object
- Object
- Yoda::Services::CurrentNodeExplain
show all
- Defined in:
- lib/yoda/services/current_node_explain.rb,
lib/yoda/services/current_node_explain/comment_signature.rb
Overview
CurrentNodeExplain shows help for the current node.
Defined Under Namespace
Classes: CommentSignature
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(evaluator:, location:) ⇒ CurrentNodeExplain
Returns a new instance of CurrentNodeExplain.
27
28
29
30
|
# File 'lib/yoda/services/current_node_explain.rb', line 27
def initialize(evaluator:, location:)
@evaluator = evaluator
@location = location
end
|
Instance Attribute Details
8
9
10
|
# File 'lib/yoda/services/current_node_explain.rb', line 8
def evaluator
@evaluator
end
|
11
12
13
|
# File 'lib/yoda/services/current_node_explain.rb', line 11
def location
@location
end
|
Class Method Details
.from_source(environment:, source:, location:) ⇒ CurrentNodeExplain
17
18
19
20
21
22
23
|
# File 'lib/yoda/services/current_node_explain.rb', line 17
def self.from_source(environment:, source:, location:)
ast, _ = Parsing.(source)
new(
evaluator: Evaluator.new(environment: environment, ast: ast),
location: location
)
end
|
Instance Method Details
39
40
41
42
|
# File 'lib/yoda/services/current_node_explain.rb', line 39
def
return nil if !valid? || ! || !
@current_comment_signature ||= CommentSignature.new(comment: , node_info: , location: location)
end
|
#current_node_signature ⇒ Model::NodeSignature?
33
34
35
36
|
# File 'lib/yoda/services/current_node_explain.rb', line 33
def current_node_signature
return nil if !valid? || !current_node
@current_node_signature ||= Model::NodeSignatures.for_node_info(current_node_info)
end
|
#valid? ⇒ true, false
45
46
47
|
# File 'lib/yoda/services/current_node_explain.rb', line 45
def valid?
!!( || current_node)
end
|