Class: Yoda::Services::CommentCompletion

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/services/comment_completion.rb,
lib/yoda/services/comment_completion/tag_provider.rb,
lib/yoda/services/comment_completion/base_provider.rb,
lib/yoda/services/comment_completion/type_provider.rb,
lib/yoda/services/comment_completion/param_provider.rb

Defined Under Namespace

Classes: BaseProvider, ParamProvider, TagProvider, TypeProvider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment, ast, comments, location) ⇒ CommentCompletion

Returns a new instance of CommentCompletion.

Parameters:



25
26
27
28
29
30
# File 'lib/yoda/services/comment_completion.rb', line 25

def initialize(environment, ast, comments, location)
  @environment = environment
  @ast = ast
  @comments = comments
  @location = location
end

Instance Attribute Details

#ast ⇒ Object (readonly)

Returns the value of attribute ast.



13
14
15
# File 'lib/yoda/services/comment_completion.rb', line 13

def ast
  @ast
end

#comments ⇒ Object (readonly)

Returns the value of attribute comments.



16
17
18
# File 'lib/yoda/services/comment_completion.rb', line 16

def comments
  @comments
end

#environment ⇒ Model::Environment (readonly)

Returns:



10
11
12
# File 'lib/yoda/services/comment_completion.rb', line 10

def environment
  @environment
end

#location ⇒ Object (readonly)

Returns the value of attribute location.



19
20
21
# File 'lib/yoda/services/comment_completion.rb', line 19

def location
  @location
end

Instance Method Details

#available? ⇒ true, false

Returns:



33
34
35
# File 'lib/yoda/services/comment_completion.rb', line 33

def available?
  comment? && providers.any?(&:available?)
end

#candidates ⇒ Array<Model::CompletionItem>

Returns:



38
39
40
# File 'lib/yoda/services/comment_completion.rb', line 38

def candidates
  available? ? providers.select(&:available?).map(&:candidates).flatten : []
end