diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 01:41:25 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-05 01:41:25 +0000 |
commit | d42d6e690e3f553b971322eae783ac6b0d4d9692 (patch) | |
tree | 2004bf4517ee7b81466c300cf30092e62e65467e /lib/rdoc/options.rb | |
parent | 670c6e8ce9d4a12bb4832e10fab27365398649bf (diff) | |
download | ruby-d42d6e690e3f553b971322eae783ac6b0d4d9692.tar.gz |
* lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(313287)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/options.rb')
-rw-r--r-- | lib/rdoc/options.rb | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index e27be89dbf..5779d35c44 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -214,6 +214,16 @@ class RDoc::Options attr_accessor :line_numbers ## + # The output locale. + + attr_accessor :locale + + ## + # The directory where locale data live. + + attr_accessor :locale_dir + + ## # Name of the file, class or module to display in the initial index page (if # not specified the first file we encounter is used) @@ -325,7 +335,7 @@ class RDoc::Options # other visibilities may be overridden on a per-method basis with the :doc: # directive. - attr_accessor :visibility + attr_reader :visibility def initialize # :nodoc: init_ivars @@ -343,6 +353,9 @@ class RDoc::Options @generators = RDoc::RDoc::GENERATORS @hyperlink_all = false @line_numbers = false + @locale = nil + @locale_name = nil + @locale_dir = 'locale' @main_page = nil @markup = 'rdoc' @coverage_report = false @@ -388,6 +401,8 @@ class RDoc::Options @generator_name = map['generator_name'] @hyperlink_all = map['hyperlink_all'] @line_numbers = map['line_numbers'] + @locale_name = map['locale_name'] + @locale_dir = map['locale_dir'] @main_page = map['main_page'] @markup = map['markup'] @op_dir = map['op_dir'] @@ -412,6 +427,8 @@ class RDoc::Options @generator_name == other.generator_name and @hyperlink_all == other.hyperlink_all and @line_numbers == other.line_numbers and + @locale == other.locale and + @locale_dir == other.locale_dir and @main_page == other.main_page and @markup == other.markup and @op_dir == other.op_dir and @@ -515,6 +532,13 @@ class RDoc::Options @template_dir = template_dir_for @template end + if @locale_name + @locale = RDoc::I18n::Locale[@locale_name] + @locale.load(@locale_dir) + else + @locale = nil + end + self end @@ -677,6 +701,19 @@ Usage: #{opt.program_name} [options] [names...] opt.separator nil end + + opt.on("--locale=NAME", + "Specifies the output locale.") do |value| + @locale_name = value + end + + opt.on("--locale-data-dir=DIR", + "Specifies the directory where locale data live.") do |value| + @locale_dir = value + end + + opt.separator nil + opt.on("--all", "-a", "Synonym for --visibility=private.") do |value| @visibility = :private @@ -1016,8 +1053,7 @@ Usage: #{opt.program_name} [options] [names...] opt.separator nil - opt.on("--help", - "Display this help") do + opt.on("--help", "-h", "Display this help") do RDoc::RDoc::GENERATORS.each_key do |generator| setup_generator generator end @@ -1174,6 +1210,22 @@ Usage: #{opt.program_name} [options] [names...] end end + # Sets the minimum visibility of a documented method. + # + # Accepts +:public+, +:protected+, +:private+, +:nodoc+, or +:all+. + # + # When +:all+ is passed, visibility is set to +:private+, similarly to + # RDOCOPT="--all", see #visibility for more information. + + def visibility= visibility + case visibility + when :all + @visibility = :private + else + @visibility = visibility + end + end + ## # Displays a warning using Kernel#warn if we're being verbose |