Class: YARD::Tags::OverloadTag
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Tag
|
|
Instance Chain:
self,
Tag
|
|
Inherits: |
YARD::Tags::Tag
|
Defined in: | lib/yard/tags/overload_tag.rb |
Class Method Summary
- .new(tag_name, text) ⇒ OverloadTag constructor
Tag
- Inherited
.new | Creates a new tag object with a tag name and text. |
Instance Attribute Summary
- #docstring readonly
- #object=(value) writeonly
- #parameters readonly
- #signature readonly
Tag
- Inherited
Instance Method Summary
- #has_tag?(name) ⇒ Boolean
- #is_a?(other) ⇒ Boolean (also: #kind_of?)
-
#kind_of?(other)
Alias for #is_a?.
- #method_missing(*args, &block)
- #name(prefix = false)
- #tag(name)
- #tags(name = nil)
- #type
- #parse_signature private
- #parse_tag(text) private
Tag
- Inherited
#explain_types | Provides a plain English summary of the type specification, or nil if no types are provided or parsable. |
#type | Convenience method to access the first type specified. |
Constructor Details
.new(tag_name, text) ⇒ OverloadTag
# 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)
[ GitHub ]# File 'lib/yard/tags/overload_tag.rb', line 28
def method_missing(*args, &block) object.send(*args, &block) end
Instance Attribute Details
#docstring (readonly)
[ GitHub ]# File 'lib/yard/tags/overload_tag.rb', line 5
attr_reader :signature, :parameters, :docstring
#object=(value) (writeonly)
[ GitHub ]#parameters (readonly)
[ GitHub ]#signature (readonly)
[ GitHub ]# File 'lib/yard/tags/overload_tag.rb', line 5
attr_reader :signature, :parameters, :docstring
Instance Method Details
#has_tag?(name) ⇒ Boolean
#is_a?(other) ⇒ Boolean
Also known as: #kind_of?
# File 'lib/yard/tags/overload_tag.rb', line 36
def is_a?(other) object.is_a?(other) || self.class >= other.class || false end
#kind_of?(other)
Alias for #is_a?.
# File 'lib/yard/tags/overload_tag.rb', line 39
alias kind_of? is_a?
#name(prefix = false)
[ GitHub ]# 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
#parse_signature (private)
[ GitHub ]# File 'lib/yard/tags/overload_tag.rb', line 53
def parse_signature if signature =~ /^(?:def\s)?\s*(#{CodeObjects::METHODMATCH})(?:(?:\s+|\s*\()(.*)(?:\)\s*$)?)?/m meth = $1 args = $2 meth.gsub!(/\s+/, '') # FIXME: refactor this code to not make use of the Handlers::Base class (tokval_list should be moved) toks = YARD::Parser::Ruby::Legacy::TokenList.new(args) args = YARD::Handlers::Ruby::Legacy::Base.new(nil, nil).send(:tokval_list, toks, :all) args = args.map do |a| k, v = *a.split(/:|=/, 2) v.strip! if v [k.strip.to_s + (a[k.size, 1] == ':' ? ':' : ''), (v && v.empty? ? nil : v)] end if args @name = meth.to_sym @parameters = args end end
#parse_tag(text) (private)
[ GitHub ]#tag(name)
[ GitHub ]#tags(name = nil)
[ GitHub ]#type
[ GitHub ]# File 'lib/yard/tags/overload_tag.rb', line 32
def type object.type end