yard-defaultreturn 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -0
- data/Rakefile +15 -0
- data/lib/yard-defaultreturn.rb +22 -0
- metadata +69 -0
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# yard-defaultreturn
|
2
|
+
|
3
|
+
Adds `@defaultreturn` tag to classes/modules to define a return tag on every
|
4
|
+
method in the namespace.
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
Using `@defaultreturn` will automatically declare `@return` tags on methods
|
9
|
+
without any return type defined inside the class/module:
|
10
|
+
|
11
|
+
# @defaultreturn [Boolean] the boolean value
|
12
|
+
class A
|
13
|
+
def foo; end
|
14
|
+
|
15
|
+
# @return [Array] override default
|
16
|
+
def bar; end
|
17
|
+
end
|
18
|
+
|
19
|
+
## Install
|
20
|
+
|
21
|
+
gem install yard-defaultreturn
|
22
|
+
|
23
|
+
or checkout source and
|
24
|
+
|
25
|
+
rake install
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
WINDOWS = (RUBY_PLATFORM =~ /win32|cygwin/ ? true : false) rescue false
|
2
|
+
SUDO = WINDOWS ? '' : 'sudo'
|
3
|
+
|
4
|
+
task :default => :install
|
5
|
+
|
6
|
+
desc "Builds the gem"
|
7
|
+
task :gem do
|
8
|
+
sh "gem build yard-defaultreturn.gemspec"
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Installs the gem"
|
12
|
+
task :install => :gem do
|
13
|
+
sh "#{SUDO} gem install yard-defaultreturn-1.0.0.gem --no-rdoc --no-ri"
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module YARD
|
2
|
+
module Plugins
|
3
|
+
module DefaultReturn
|
4
|
+
module MethodHandler
|
5
|
+
def register(*objects)
|
6
|
+
retval = super
|
7
|
+
objects.each do |object|
|
8
|
+
if (tag = namespace.tag(:defaultreturn)) && !object.has_tag?(:return)
|
9
|
+
object.docstring.add_tag Tags::Tag.new(:return, tag.text, tag.types)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
retval
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Handlers::Ruby::MethodHandler.send(:include, MethodHandler)
|
17
|
+
Handlers::Ruby::Legacy::MethodHandler.send(:include, MethodHandler)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
YARD::Tags::Library.define_tag("Default Return", :defaultreturn, :with_types)
|
metadata
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-defaultreturn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Loren Segal
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-21 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: lsegal@soen.ca
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files: []
|
29
|
+
|
30
|
+
files:
|
31
|
+
- README.md
|
32
|
+
- Rakefile
|
33
|
+
- lib/yard-defaultreturn.rb
|
34
|
+
has_rdoc: true
|
35
|
+
homepage: http://github.com/lsegal/yard-defaultreturn
|
36
|
+
licenses: []
|
37
|
+
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
hash: 3
|
49
|
+
segments:
|
50
|
+
- 0
|
51
|
+
version: "0"
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
requirements: []
|
62
|
+
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 1.3.7
|
65
|
+
signing_key:
|
66
|
+
specification_version: 3
|
67
|
+
summary: YARD plugin to add default return types to methods in a namespace.
|
68
|
+
test_files: []
|
69
|
+
|