Class: YARD::Tags::OverloadTag

Inherits:
Tag
  • Object
show all
Defined in:
lib/yard/tags/overload_tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, text) ⇒ OverloadTag

Returns a new instance of OverloadTag.



7
8
9
10
11
# File 'lib/yard/tags/overload_tag.rb', line 7

def initialize(tag_name, text)
  super(tag_name, nil)
  parse_tag(text)
  parse_signature
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



28
29
30
# File 'lib/yard/tags/overload_tag.rb', line 28

def method_missing(*args, &block)
  object.send(*args, &block)
end

Instance Attribute Details

#docstringObject (readonly)

Returns the value of attribute docstring.



5
6
7
# File 'lib/yard/tags/overload_tag.rb', line 5

def docstring
  @docstring
end

#parametersObject (readonly)

Returns the value of attribute parameters.



5
6
7
# File 'lib/yard/tags/overload_tag.rb', line 5

def parameters
  @parameters
end

#signatureObject (readonly)

Returns the value of attribute signature.



5
6
7
# File 'lib/yard/tags/overload_tag.rb', line 5

def signature
  @signature
end

Instance Method Details

#has_tag?(name) ⇒ Boolean

Returns:

  • (Boolean)


15
# File 'lib/yard/tags/overload_tag.rb', line 15

def has_tag?(name) docstring.has_tag?(name) end

#is_a?(other) ⇒ Boolean Also known as: kind_of?

Returns:

  • (Boolean)


36
37
38
# File 'lib/yard/tags/overload_tag.rb', line 36

def is_a?(other)
  object.is_a?(other) || self.class >= other.class || false
end

#name(prefix = false) ⇒ Object



23
24
25
26
# File 'lib/yard/tags/overload_tag.rb', line 23

def name(prefix = false)
  return @name unless prefix
  object.scope == :class ? @name.to_s : "#{object.send(:sep)}#{@name}"
end

#object=(value) ⇒ Object



17
18
19
20
21
# File 'lib/yard/tags/overload_tag.rb', line 17

def object=(value)
  super(value)
  docstring.object = value
  docstring.tags.each {|tag| tag.object = value }
end

#tag(name) ⇒ Object



13
# File 'lib/yard/tags/overload_tag.rb', line 13

def tag(name) docstring.tag(name) end

#tags(name = nil) ⇒ Object



14
# File 'lib/yard/tags/overload_tag.rb', line 14

def tags(name = nil) docstring.tags(name) end

#typeObject



32
33
34
# File 'lib/yard/tags/overload_tag.rb', line 32

def type
  object.type
end