Class: JsDuck::ReturnValues

Inherits:
Object
  • Object
show all
Defined in:
lib/jsduck/return_values.rb

Overview

Auto-detector return values and @chainable tags.

Adds @chainable tag when doc-comment contains @return OwnerClass this. Also the other way around: when @chainable found, adds appropriate @return.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relations) ⇒ ReturnValues

Returns a new instance of ReturnValues.



14
15
16
17
# File 'lib/jsduck/return_values.rb', line 14

def initialize(relations)
  @relations = relations
  @cls = nil
end

Class Method Details

.auto_detect(relations) ⇒ Object

Only this static method of this class should be called.



10
11
12
# File 'lib/jsduck/return_values.rb', line 10

def self.auto_detect(relations)
  ReturnValues.new(relations).process_all!
end

Instance Method Details

#process_all!Object



19
20
21
22
23
24
25
26
# File 'lib/jsduck/return_values.rb', line 19

def process_all!
  @relations.each do |cls|
    @cls = cls
    cls.find_members(:tagname => :method, :local => true, :static => false).each do |m|
      process(m)
    end
  end
end