Module: YARDHeuristics

Defined in:
lib/yard-heuristics-1.0.rb,
lib/yard-heuristics/version.rb

Overview

Namespace for YARD heuristics.

Constant Summary collapse

ParamTypes =
{
  'index' => %w'Integer',
  'object' => %w'Object',
  'range' => %w'Range',
  'string' => %w'String'
}
ReturnTypes =
{
  :<< => :self_or_type,
  :>> => :self_or_type,
  :== => %w'Boolean',
  :=== => %w'Boolean',
  :=~ => %w'Boolean',
  :<=> => %w'Integer nil',
  :+ => :type,
  :- => :type,
  :* => :type,
  :/ => :type,
  :each => %w'self',
  :each_with_index => %w'self',
  :hash => %w'Integer',
  :inspect => %w'String',
  :length => %w'Integer',
  :size => %w'Integer',
  :to_s => %w'String',
  :to_str => %w'String'
}
Version =
Inventory.new(1, 1, 0){
  def dependencies
    super + Inventory::Dependencies.new{
      development 'inventory-rake', 1, 3, 0
      development 'lookout', 3, 0, 0
      development 'lookout-rake', 3, 0, 0
      runtime 'yard', 0, 8, 0, :feature => 'yard'
    }
  end
}

Class Method Summary collapse

Class Method Details

.set_or_add_param_tag(overload, name, types) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/yard-heuristics-1.0.rb', line 37

def set_or_add_param_tag(overload, name, types)
  base = name.sub(/\A[&*]/, '')
  if tag = overload.tags.find{ |e| e.tag_name == 'param' and e.name == base }
    tag.types = types unless tag.types
  else
    tag = YARD::Tags::Tag.new(:param, '', types, base)
    if overload.respond_to? :docstring
      overload.docstring.add_tag tag
    else
      overload.tags << tag
    end
  end
  self
end