From fc77d9d1cbfb857a4429627bd58d6c015c6fe133 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 31 Jan 2009 05:18:25 +0000 Subject: rdoc update. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/pathname.rb | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'lib') diff --git a/lib/pathname.rb b/lib/pathname.rb index c24687bffd..9d874a0f5e 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -36,27 +36,27 @@ # === Example 1: Using Pathname # # require 'pathname' -# p = Pathname.new("/usr/bin/ruby") -# size = p.size # 27662 -# isdir = p.directory? # false -# dir = p.dirname # Pathname:/usr/bin -# base = p.basename # Pathname:ruby -# dir, base = p.split # [Pathname:/usr/bin, Pathname:ruby] -# data = p.read -# p.open { |f| _ } -# p.each_line { |line| _ } +# pn = Pathname.new("/usr/bin/ruby") +# size = pn.size # 27662 +# isdir = pn.directory? # false +# dir = pn.dirname # Pathname:/usr/bin +# base = pn.basename # Pathname:ruby +# dir, base = pn.split # [Pathname:/usr/bin, Pathname:ruby] +# data = pn.read +# pn.open { |f| _ } +# pn.each_line { |line| _ } # # === Example 2: Using standard Ruby # -# p = "/usr/bin/ruby" -# size = File.size(p) # 27662 -# isdir = File.directory?(p) # false -# dir = File.dirname(p) # "/usr/bin" -# base = File.basename(p) # "ruby" -# dir, base = File.split(p) # ["/usr/bin", "ruby"] -# data = File.read(p) -# File.open(p) { |f| _ } -# File.foreach(p) { |line| _ } +# pn = "/usr/bin/ruby" +# size = File.size(pn) # 27662 +# isdir = File.directory?(pn) # false +# dir = File.dirname(pn) # "/usr/bin" +# base = File.basename(pn) # "ruby" +# dir, base = File.split(pn) # ["/usr/bin", "ruby"] +# data = File.read(pn) +# File.open(pn) { |f| _ } +# File.foreach(pn) { |line| _ } # # === Example 3: Special features # @@ -690,12 +690,12 @@ class Pathname # filename only. # # For example: - # p = Pathname("/usr/lib/ruby/1.8") - # p.children + # pn = Pathname("/usr/lib/ruby/1.8") + # pn.children # # -> [ Pathname:/usr/lib/ruby/1.8/English.rb, # Pathname:/usr/lib/ruby/1.8/Env.rb, # Pathname:/usr/lib/ruby/1.8/abbrev.rb, ... ] - # p.children(false) + # pn.children(false) # # -> [ Pathname:English.rb, Pathname:Env.rb, Pathname:abbrev.rb, ... ] # # Note that the result never contain the entries . and .. in @@ -997,7 +997,7 @@ end class Pathname # * Dir * # See Dir.glob. Returns or yields Pathname objects. - def Pathname.glob(*args) # :yield: p + def Pathname.glob(*args) # :yield: pathname if block_given? Dir.glob(*args) {|f| yield self.new(f) } else @@ -1029,7 +1029,7 @@ class Pathname # * Dir * # yields a Pathname object for each entry. # # This method has existed since 1.8.1. - def each_entry(&block) # :yield: p + def each_entry(&block) # :yield: pathname Dir.foreach(@path) {|f| yield self.class.new(f) } end @@ -1063,7 +1063,7 @@ class Pathname # * Find * # If +self+ is ., yielded pathnames begin with a filename in the # current directory, not ./. # - def find(&block) # :yield: p + def find(&block) # :yield: pathname require 'find' if @path == '.' Find.find(@path) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) } -- cgit v1.2.3