yard 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/README.md +14 -2
- data/Rakefile +5 -10
- data/benchmarks/parsing.rb +2 -2
- data/docs/WhatsNew.md +43 -5
- data/lib/rubygems_plugin.rb +49 -45
- data/lib/yard.rb +1 -1
- data/lib/yard/cli/base.rb +4 -0
- data/lib/yard/cli/yard_graph.rb +1 -0
- data/lib/yard/cli/yardoc.rb +24 -2
- data/lib/yard/cli/yri.rb +1 -0
- data/lib/yard/code_objects/base.rb +9 -0
- data/lib/yard/code_objects/class_object.rb +1 -1
- data/lib/yard/code_objects/method_object.rb +20 -4
- data/lib/yard/core_ext/file.rb +6 -0
- data/lib/yard/core_ext/hash.rb +1 -1
- data/lib/yard/core_ext/string.rb +3 -1
- data/lib/yard/handlers/ruby/attribute_handler.rb +22 -18
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +21 -17
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +8 -0
- data/lib/yard/handlers/ruby/method_handler.rb +8 -1
- data/lib/yard/logging.rb +1 -1
- data/lib/yard/parser/c_parser.rb +10 -17
- data/lib/yard/parser/ruby/legacy/statement_list.rb +7 -0
- data/lib/yard/parser/ruby/ruby_parser.rb +2 -1
- data/lib/yard/parser/source_parser.rb +20 -3
- data/lib/yard/templates/helpers/html_helper.rb +48 -22
- data/lib/yard/templates/template.rb +6 -1
- data/spec/cli/yardoc_spec.rb +22 -0
- data/spec/code_objects/base_spec.rb +34 -1
- data/spec/code_objects/method_object_spec.rb +35 -0
- data/spec/core_ext/hash_spec.rb +4 -0
- data/spec/core_ext/string_spec.rb +5 -1
- data/spec/handlers/attribute_handler_spec.rb +9 -1
- data/spec/handlers/examples/attribute_handler_001.rb.txt +8 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +6 -0
- data/spec/handlers/method_handler_spec.rb +10 -0
- data/spec/parser/source_parser_spec.rb +29 -26
- data/spec/spec_helper.rb +1 -1
- data/spec/templates/engine_spec.rb +1 -0
- data/spec/templates/examples/class001.html +4 -0
- data/spec/templates/examples/class001.txt +5 -0
- data/spec/templates/examples/module001.dot +1 -1
- data/spec/templates/examples/module001.html +92 -12
- data/spec/templates/helpers/html_helper_spec.rb +25 -5
- data/spec/templates/module_spec.rb +3 -1
- data/spec/templates/template_spec.rb +11 -1
- data/templates/default/class/html/subclasses.erb +1 -1
- data/templates/default/class/setup.rb +10 -3
- data/templates/default/class/text/subclasses.erb +1 -1
- data/templates/default/fulldoc/html/css/full_list.css +38 -11
- data/templates/default/fulldoc/html/css/style.css +6 -1
- data/templates/default/fulldoc/html/frames.erb +13 -0
- data/templates/default/fulldoc/html/full_list.erb +20 -22
- data/templates/default/fulldoc/html/full_list_class.erb +2 -0
- data/templates/default/fulldoc/html/full_list_files.erb +5 -0
- data/templates/default/fulldoc/html/full_list_methods.erb +12 -0
- data/templates/default/fulldoc/html/js/app.js +10 -2
- data/templates/default/fulldoc/html/js/full_list.js +76 -9
- data/templates/default/fulldoc/html/setup.rb +37 -2
- data/templates/default/layout/html/breadcrumb.erb +3 -1
- data/templates/default/layout/html/layout.erb +4 -0
- data/templates/default/layout/html/search.erb +1 -1
- data/templates/default/layout/html/setup.rb +13 -2
- data/templates/default/module/dot/info.erb +1 -1
- data/templates/default/module/html/attribute_details.erb +1 -1
- data/templates/default/module/html/constant_summary.erb +1 -1
- data/templates/default/module/html/item_summary.erb +2 -2
- metadata +6 -2
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
YARD Release 0.5.
|
2
|
-
|
1
|
+
YARD Release 0.5.3 "The Longest" (Jan 11th 2010)
|
2
|
+
================================================
|
3
3
|
|
4
4
|
**Homepage**: [http://yardoc.org](http://yardoc.org)
|
5
5
|
**IRC**: **Join us on IRC in #yard on irc.freenode.net!**
|
@@ -222,6 +222,18 @@ More options can be seen by typing `yard-graph --help`, but here is an example:
|
|
222
222
|
CHANGELOG
|
223
223
|
---------
|
224
224
|
|
225
|
+
- **January.11.10**: 0.5.3 release
|
226
|
+
- See {file:docs/WhatsNew.md what's new document} for changes
|
227
|
+
|
228
|
+
- **December.16.09**: 0.5.2 release
|
229
|
+
- See {file:docs/WhatsNew.md what's new document} for changes
|
230
|
+
|
231
|
+
- **December.15.09**: 0.5.1 release
|
232
|
+
- See {file:docs/WhatsNew.md what's new document} for changes
|
233
|
+
|
234
|
+
- **December.13.09**: 0.5.0 release
|
235
|
+
- See {file:docs/WhatsNew.md what's new document} for changes
|
236
|
+
|
225
237
|
- **November.15.09**: 0.4.0 release
|
226
238
|
- Added new templating engine based on [tadpole](http://github.com/lsegal/tadpole)
|
227
239
|
- Added YARD queries (`--query` CLI argument to yardoc)
|
data/Rakefile
CHANGED
@@ -1,23 +1,18 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/lib/yard'
|
2
|
-
require 'rubygems'
|
3
|
-
require 'rake/gempackagetask'
|
4
2
|
|
5
3
|
WINDOWS = (RUBY_PLATFORM =~ /win32|cygwin/ ? true : false) rescue false
|
6
4
|
SUDO = WINDOWS ? '' : 'sudo'
|
7
5
|
|
8
6
|
task :default => :specs
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
pkg.need_zip = true
|
14
|
-
pkg.need_tar = true
|
8
|
+
desc "Builds the gem"
|
9
|
+
task :gem do
|
10
|
+
sh "gem build yard.gemspec"
|
15
11
|
end
|
16
12
|
|
17
|
-
desc "
|
13
|
+
desc "Installs the gem"
|
18
14
|
task :install => :gem do
|
19
|
-
sh "#{SUDO} gem install
|
20
|
-
sh "rm -rf pkg/yard-#{SPEC.version}" unless ENV['KEEP_FILES']
|
15
|
+
sh "#{SUDO} gem install yard-#{YARD::VERSION}.gem --no-rdoc --no-ri"
|
21
16
|
end
|
22
17
|
|
23
18
|
begin
|
data/benchmarks/parsing.rb
CHANGED
@@ -14,8 +14,8 @@ PATH_ORDER = [
|
|
14
14
|
]
|
15
15
|
|
16
16
|
Benchmark.bmbm do |x|
|
17
|
-
x.report("parse in order") { YARD::Registry.clear; YARD.parse PATH_ORDER, Logger::ERROR }
|
18
|
-
x.report("parse") { YARD::Registry.clear; YARD.parse 'lib/**/*.rb', Logger::ERROR }
|
17
|
+
x.report("parse in order") { YARD::Registry.clear; YARD.parse PATH_ORDER, [], Logger::ERROR }
|
18
|
+
x.report("parse") { YARD::Registry.clear; YARD.parse 'lib/**/*.rb', [], Logger::ERROR }
|
19
19
|
end
|
20
20
|
|
21
21
|
=begin
|
data/docs/WhatsNew.md
CHANGED
@@ -2,13 +2,16 @@ What's New in 0.5.x?
|
|
2
2
|
====================
|
3
3
|
|
4
4
|
1. **Support for documenting native Ruby C code** (0.5.0)
|
5
|
-
2. **Incremental parsing and output generation with `yardoc -c`** (0.5.0)
|
5
|
+
2. **Incremental parsing and output generation with `yardoc -c`** (0.5.0, 0.5.3)
|
6
6
|
2. **Improved `yri` support to perform lookups on installed Gems** (0.5.0)
|
7
7
|
3. **Added `yardoc --default-return` and `yardoc --hide-void-return`** (0.5.0)
|
8
8
|
4. **Multiple syntax highlighting language support** (0.5.0)
|
9
9
|
5. **New .yardoc format** (0.5.0)
|
10
10
|
6. **Support for yard-doc-* gem packages as hosted .yardoc dbs** (0.5.1)
|
11
11
|
7. **Support for extra search paths in `yri`** (0.5.1)
|
12
|
+
8. **Generating HTML docs now adds frames view** (0.5.3)
|
13
|
+
9. **Tree view for class list** (0.5.3)
|
14
|
+
10. **Ability to specify markup format of extra files** (0.5.3)
|
12
15
|
|
13
16
|
Support for documenting native Ruby C code (0.5.0)
|
14
17
|
--------------------------------------------------
|
@@ -19,18 +22,26 @@ Ruby's core and stdlibs which will be hosted on http://yardoc.org/docs. In
|
|
19
22
|
addition, the .yardoc dump for the Ruby-core classes will become available
|
20
23
|
as an installable gem for yri support (see #3).
|
21
24
|
|
22
|
-
Incremental parsing and output generation with `yardoc -c` (0.5.0)
|
23
|
-
|
25
|
+
Incremental parsing and output generation with `yardoc -c` (0.5.0, 0.5.3)
|
26
|
+
-------------------------------------------------------------------------
|
24
27
|
|
25
|
-
|
28
|
+
<p class="note">Note: in 0.5.3 and above you must use <tt>--incremental</tt>
|
29
|
+
to incrementally generate HTML, otherwise only parsing will be done
|
30
|
+
incrementally but HTML will be generated with all objects. <tt>--incremental</tt>
|
31
|
+
implies <tt>-c</tt>, so no need to specify them both.</p>
|
32
|
+
|
33
|
+
YARD now compares file checksums before parsing when using `yardoc -c`
|
26
34
|
(aka `yardoc --use-cache`) to do incremental parsing of only the files that
|
27
35
|
have changed. HTML (or other output format) generation will also only be
|
28
|
-
done on the objects that were parsed from changed files. This makes doing
|
36
|
+
done on the objects that were parsed from changed files (*). This makes doing
|
29
37
|
a documentation development cycle much faster for quick HTML previews. Just
|
30
38
|
remember that when using incremental output generation, the index will not
|
31
39
|
be rebuilt and inter-file links might not hook up right, so it is best to
|
32
40
|
perform a full rebuild at the end of such previews.
|
33
41
|
|
42
|
+
(*) Only for versions prior to 0.5.3. For 0.5.3+, use `--incremental` for
|
43
|
+
incremental HTML output.
|
44
|
+
|
34
45
|
Improved `yri` support to perform lookups on installed Gems (0.5.0)
|
35
46
|
-------------------------------------------------------------------
|
36
47
|
|
@@ -124,6 +135,33 @@ Support for extra search paths in `yri` (0.5.1)
|
|
124
135
|
You can now add custom paths to non-gem .yardoc files
|
125
136
|
by adding them as newline separated paths in `~/.yard/yri_search_paths`.
|
126
137
|
|
138
|
+
Generating HTML docs now adds frames view (0.5.3)
|
139
|
+
-------------------------------------------------
|
140
|
+
|
141
|
+
`yardoc` will now create a `frames.html` file when generating HTML documents
|
142
|
+
which allows the user to view documentation inside frames, for those users who
|
143
|
+
still find frames beneficial.
|
144
|
+
|
145
|
+
Tree view for class list (0.5.3)
|
146
|
+
--------------------------------
|
147
|
+
|
148
|
+
The class list now displays as an expandable tree view to better organized an
|
149
|
+
otherwise cluttered namespace. If you properly namespace your less important
|
150
|
+
classes (like Rails timezone classes), they will not take up space in the
|
151
|
+
class list unless the user looks for them.
|
152
|
+
|
153
|
+
Ability to specify markup format of extra files (0.5.3)
|
154
|
+
-------------------------------------------------------
|
155
|
+
|
156
|
+
You can now specify the markup format of an extra file (like README) at the
|
157
|
+
top of the file with a shebang-like line:
|
158
|
+
|
159
|
+
#!textile
|
160
|
+
contents here
|
161
|
+
|
162
|
+
The above file contents will be rendered with a textile markup engine
|
163
|
+
(eg. RedCloth).
|
164
|
+
|
127
165
|
|
128
166
|
What's New in 0.4.x?
|
129
167
|
====================
|
data/lib/rubygems_plugin.rb
CHANGED
@@ -6,7 +6,7 @@ class Gem::Specification
|
|
6
6
|
overwrite_accessor(:has_rdoc) { @has_rdoc }
|
7
7
|
overwrite_accessor(:has_rdoc=) {|v| @has_rdoc = v }
|
8
8
|
|
9
|
-
def
|
9
|
+
def has_yardoc=(value)
|
10
10
|
@has_rdoc = 'yard'
|
11
11
|
end
|
12
12
|
|
@@ -22,61 +22,65 @@ class Gem::Specification
|
|
22
22
|
alias has_yardoc? has_yardoc
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def run_yardoc(*args)
|
31
|
-
args << @spec.rdoc_options
|
32
|
-
args << '--quiet'
|
33
|
-
if @spec.extra_rdoc_files.size > 0
|
34
|
-
args << '--files'
|
35
|
-
args << @spec.extra_rdoc_files.join(",")
|
25
|
+
unless defined? Gem::DocManager.load_yardoc
|
26
|
+
class Gem::DocManager
|
27
|
+
def self.load_yardoc
|
28
|
+
require File.dirname(__FILE__) + '/yard'
|
36
29
|
end
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
rescue => ex
|
47
|
-
alert_error "While generating documentation for #{@spec.full_name}"
|
48
|
-
ui.errs.puts "... MESSAGE: #{ex}"
|
49
|
-
ui.errs.puts "... YARDDOC args: #{args.join(' ')}"
|
50
|
-
ui.errs.puts "\t#{ex.backtrace.join("\n\t")}" if Gem.configuration.backtrace
|
51
|
-
ui.errs.puts "(continuing with the rest of the installation)"
|
52
|
-
ensure
|
53
|
-
Dir.chdir(old_pwd)
|
54
|
-
end
|
30
|
+
|
31
|
+
def run_yardoc(*args)
|
32
|
+
args << '--quiet'
|
33
|
+
args << @spec.require_paths
|
34
|
+
if @spec.extra_rdoc_files.size > 0
|
35
|
+
args << '-'
|
36
|
+
args += @spec.extra_rdoc_files
|
37
|
+
end
|
38
|
+
args = args.flatten.map {|arg| arg.to_s }
|
55
39
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
40
|
+
old_pwd = Dir.pwd
|
41
|
+
Dir.chdir(@spec.full_gem_path)
|
42
|
+
YARD::CLI::Yardoc.run(*args)
|
43
|
+
rescue Errno::EACCES => e
|
44
|
+
dirname = File.dirname e.message.split("-")[1].strip
|
45
|
+
raise Gem::FilePermissionError.new(dirname)
|
46
|
+
rescue => ex
|
47
|
+
alert_error "While generating documentation for #{@spec.full_name}"
|
48
|
+
ui.errs.puts "... MESSAGE: #{ex}"
|
49
|
+
ui.errs.puts "... YARDDOC args: #{args.join(' ')}"
|
50
|
+
ui.errs.puts "\t#{ex.backtrace.join("\n\t")}" if Gem.configuration.backtrace
|
51
|
+
ui.errs.puts "(continuing with the rest of the installation)"
|
52
|
+
ensure
|
53
|
+
Dir.chdir(old_pwd)
|
60
54
|
end
|
61
55
|
|
62
|
-
|
56
|
+
undef setup_rdoc
|
57
|
+
def setup_rdoc
|
58
|
+
if File.exist?(@doc_dir) && !File.writable?(@doc_dir) then
|
59
|
+
raise Gem::FilePermissionError.new(@doc_dir)
|
60
|
+
end
|
63
61
|
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir)
|
63
|
+
|
64
|
+
self.class.load_rdoc if @spec.has_rdoc?
|
65
|
+
self.class.load_yardoc if @spec.has_yardoc?
|
66
|
+
end
|
67
67
|
|
68
|
-
|
69
|
-
|
68
|
+
def install_yardoc
|
69
|
+
rdoc_dir = File.join(@doc_dir, 'rdoc')
|
70
70
|
|
71
|
-
|
71
|
+
FileUtils.rm_rf rdoc_dir
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
say "Installing YARD documentation for #{@spec.full_name}..."
|
74
|
+
run_yardoc '-o', rdoc_dir
|
75
|
+
end
|
76
76
|
|
77
|
-
unless instance_methods.include?(:install_ri_yard)
|
78
77
|
def install_ri_yard
|
79
78
|
install_ri_yard_orig if @spec.has_rdoc?
|
79
|
+
return if @spec.has_yardoc?
|
80
|
+
|
81
|
+
self.class.load_yardoc
|
82
|
+
say "Building YARD (yri) index for #{@spec.full_name}..."
|
83
|
+
run_yardoc '-c', '-n'
|
80
84
|
end
|
81
85
|
alias install_ri_yard_orig install_ri
|
82
86
|
alias install_ri install_ri_yard
|
data/lib/yard.rb
CHANGED
data/lib/yard/cli/base.rb
CHANGED
data/lib/yard/cli/yard_graph.rb
CHANGED
data/lib/yard/cli/yardoc.rb
CHANGED
@@ -14,11 +14,18 @@ module YARD
|
|
14
14
|
# @return [Array<String>] list of Ruby source files to process
|
15
15
|
attr_accessor :files
|
16
16
|
|
17
|
+
# @return [Array<String>] list of excluded paths (regexp matches)
|
18
|
+
attr_accessor :excluded
|
19
|
+
|
17
20
|
# @return [Boolean] whether to use the existing yardoc db if the
|
18
21
|
# .yardoc already exists. Also makes use of file checksums to
|
19
22
|
# parse only changed files.
|
20
23
|
attr_accessor :use_cache
|
21
24
|
|
25
|
+
# @return [Boolean] whether to generate output incrementally (
|
26
|
+
# implies use_cache and generate)
|
27
|
+
attr_accessor :incremental
|
28
|
+
|
22
29
|
# @return [Boolean] whether to generate output
|
23
30
|
attr_accessor :generate
|
24
31
|
|
@@ -32,6 +39,7 @@ module YARD
|
|
32
39
|
|
33
40
|
# Creates a new instance of the commandline utility
|
34
41
|
def initialize
|
42
|
+
super
|
35
43
|
@options = SymbolHash.new(false)
|
36
44
|
@options.update(
|
37
45
|
:format => :html,
|
@@ -45,9 +53,11 @@ module YARD
|
|
45
53
|
:visibilities => [:public],
|
46
54
|
:verifier => nil
|
47
55
|
)
|
56
|
+
@excluded = []
|
48
57
|
@files = []
|
49
58
|
@use_cache = false
|
50
59
|
@generate = true
|
60
|
+
@incremental = false
|
51
61
|
@options_file = DEFAULT_YARDOPTS_FILE
|
52
62
|
end
|
53
63
|
|
@@ -65,13 +75,14 @@ module YARD
|
|
65
75
|
Registry.load
|
66
76
|
checksums = Registry.checksums.dup
|
67
77
|
end
|
68
|
-
YARD.parse(files)
|
78
|
+
YARD.parse(files, excluded)
|
69
79
|
Registry.save(use_cache)
|
70
80
|
|
71
81
|
if generate
|
72
|
-
if
|
82
|
+
if incremental
|
73
83
|
generate_with_cache(checksums)
|
74
84
|
else
|
85
|
+
Registry.load_all if use_cache
|
75
86
|
Templates::Engine.generate(all_objects, options)
|
76
87
|
end
|
77
88
|
end
|
@@ -184,6 +195,7 @@ module YARD
|
|
184
195
|
# Parses commandline options.
|
185
196
|
# @param [Array<String>] args each tokenized argument
|
186
197
|
def optparse(*args)
|
198
|
+
excluded = []
|
187
199
|
query_expressions = []
|
188
200
|
do_build_gems, do_rebuild_gems = false, false
|
189
201
|
serialopts = SymbolHash.new
|
@@ -225,6 +237,16 @@ module YARD
|
|
225
237
|
end
|
226
238
|
end
|
227
239
|
|
240
|
+
opts.on('--incremental', 'Generates output for changed files only (implies -c)') do
|
241
|
+
self.incremental = true
|
242
|
+
self.generate = true
|
243
|
+
self.use_cache = true
|
244
|
+
end
|
245
|
+
|
246
|
+
opts.on('--exclude REGEXP', 'Ignores a file if it matches path match (regexp)') do |path|
|
247
|
+
self.excluded << path
|
248
|
+
end
|
249
|
+
|
228
250
|
opts.on('--legacy', 'Use old style parser and handlers. Unavailable under Ruby 1.8.x') do
|
229
251
|
YARD::Parser::SourceParser.parser_type = :ruby18
|
230
252
|
end
|
data/lib/yard/cli/yri.rb
CHANGED
@@ -129,6 +129,7 @@ module YARD
|
|
129
129
|
# @return [Base]
|
130
130
|
# @see #initialize
|
131
131
|
def new(namespace, name, *args, &block)
|
132
|
+
raise ArgumentError, "invalid empty object name" if name.to_s.empty?
|
132
133
|
if name.to_s[0,2] == NSEP
|
133
134
|
name = name.to_s[2..-1]
|
134
135
|
namespace = Registry.root
|
@@ -346,6 +347,14 @@ module YARD
|
|
346
347
|
end
|
347
348
|
alias_method :to_s, :path
|
348
349
|
|
350
|
+
# @param [Base, String] other another code object (or object path)
|
351
|
+
# @return [String] the shortest relative path from this object to +other+
|
352
|
+
def relative_path(other)
|
353
|
+
other = other.path if other.respond_to?(:path)
|
354
|
+
return other unless namespace
|
355
|
+
other.gsub(/^#{Regexp.quote namespace.path}(::|\.)?/, '')
|
356
|
+
end
|
357
|
+
|
349
358
|
# Renders the object using the {Templates::Engine templating system}.
|
350
359
|
#
|
351
360
|
# @example Formats a class in plaintext
|
@@ -120,7 +120,7 @@ module YARD::CodeObjects
|
|
120
120
|
raise ArgumentError, "superclass must be CodeObject, Proxy, String or Symbol"
|
121
121
|
end
|
122
122
|
|
123
|
-
if name == @superclass.name && namespace != YARD::Registry.root && object.is_a?(
|
123
|
+
if name == @superclass.name && namespace != YARD::Registry.root && !object.is_a?(Base)
|
124
124
|
@superclass = Proxy.new(namespace.namespace, object)
|
125
125
|
end
|
126
126
|
|
@@ -56,14 +56,30 @@ module YARD::CodeObjects
|
|
56
56
|
def constructor?
|
57
57
|
name == :initialize && scope == :instance && namespace.is_a?(ClassObject)
|
58
58
|
end
|
59
|
+
|
60
|
+
# Returns the read/writer info for the attribute if it is one
|
61
|
+
# @return [SymbolHash] if there is information about the attribute
|
62
|
+
# @return [nil] if the method is not an attribute
|
63
|
+
def attr_info
|
64
|
+
return nil unless namespace.is_a?(NamespaceObject)
|
65
|
+
namespace.attributes[scope][name.to_s.gsub(/=$/, '')]
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Boolean] whether the method is a writer attribute
|
69
|
+
def writer?
|
70
|
+
!!((info = attr_info) && info[:write] == self)
|
71
|
+
end
|
72
|
+
|
73
|
+
# @return [Boolean] whether the method is a reader attribute
|
74
|
+
def reader?
|
75
|
+
!!((info = attr_info) && info[:read] == self)
|
76
|
+
end
|
59
77
|
|
60
78
|
# Tests if the object is defined as an attribute in the namespace
|
61
79
|
# @return [Boolean] whether the object is an attribute
|
62
80
|
def is_attribute?
|
63
|
-
return false unless
|
64
|
-
|
65
|
-
return false unless attr_obj
|
66
|
-
attr_obj[name.to_s =~ /=$/ ? :write : :read] ? true : false
|
81
|
+
return false unless info = attr_info
|
82
|
+
info[name.to_s =~ /=$/ ? :write : :read] ? true : false
|
67
83
|
end
|
68
84
|
|
69
85
|
# Tests if the object is defined as an alias of another method
|