зеркало из https://github.com/github/ruby.git
* lib/abbrev.rb: fix r37113. Correct examples, fix style
and show explicit dependency (require 'abbrev'). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
25058a58a2
Коммит
5bab434018
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Nov 17 08:13:48 2012 Benoit Daloze <eregontp@gmail.com>
|
||||||
|
|
||||||
|
* lib/abbrev.rb: fix r37113. Correct examples, fix style
|
||||||
|
and show explicit dependency (require 'abbrev').
|
||||||
|
|
||||||
Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@gmail.com>
|
Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@gmail.com>
|
||||||
|
|
||||||
* win32/file.c (replace_to_long_name): skip automatic path expansion
|
* win32/file.c (replace_to_long_name): skip automatic path expansion
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#
|
#
|
||||||
# It also provides an array core extension, Array#abbrev.
|
# It also provides an array core extension, Array#abbrev.
|
||||||
#
|
#
|
||||||
# pp %w{april may}.abbrev
|
# pp %w{summer winter}.abbrev
|
||||||
# #=> {"summe"=>"summer",
|
# #=> {"summe"=>"summer",
|
||||||
# "summ"=>"summer",
|
# "summ"=>"summer",
|
||||||
# "sum"=>"summer",
|
# "sum"=>"summer",
|
||||||
|
@ -54,16 +54,15 @@ module Abbrev
|
||||||
# "cone".
|
# "cone".
|
||||||
#
|
#
|
||||||
# require 'abbrev'
|
# require 'abbrev'
|
||||||
# require 'pp'
|
|
||||||
#
|
#
|
||||||
# pp Abbrev.abbrev(['car', 'cone'])
|
# Abbrev.abbrev(['car', 'cone'])
|
||||||
# #=> {"ca"=>"car", "con"=>"cone", "co"=>"cone", "car"=>"car", "cone"=>"cone"}
|
# #=> {"ca"=>"car", "con"=>"cone", "co"=>"cone", "car"=>"car", "cone"=>"cone"}
|
||||||
#
|
#
|
||||||
# The optional +pattern+ parameter is a pattern or a string. Only
|
# The optional +pattern+ parameter is a pattern or a string. Only
|
||||||
# input strings that match the pattern or start with the string
|
# input strings that match the pattern or start with the string
|
||||||
# are included in the output hash.
|
# are included in the output hash.
|
||||||
#
|
#
|
||||||
# pp %w{car box cone}.abbrev(/b/)
|
# Abbrev.abbrev(%w{car box cone}, /b/)
|
||||||
# #=> {"bo"=>"box", "b"=>"box", "box"=>"box"}
|
# #=> {"bo"=>"box", "b"=>"box", "box"=>"box"}
|
||||||
def abbrev(words, pattern = nil)
|
def abbrev(words, pattern = nil)
|
||||||
table = {}
|
table = {}
|
||||||
|
@ -107,18 +106,18 @@ class Array
|
||||||
# Calculates the set of unambiguous abbreviations for the strings in
|
# Calculates the set of unambiguous abbreviations for the strings in
|
||||||
# +self+.
|
# +self+.
|
||||||
#
|
#
|
||||||
# abbr = %w{ car cone }.abbrev
|
# require 'abbrev'
|
||||||
# abbr #=> { "ca" => "car", "car" => "car",
|
# %w{ car cone }.abbrev
|
||||||
# "co" => "cone", "con" => "cone",
|
# #=> {"ca" => "car", "con"=>"cone", "co" => "cone",
|
||||||
# "cone" => "cone" }
|
# "car"=>"car", "cone" => "cone"}
|
||||||
#
|
#
|
||||||
# The optional +pattern+ parameter is a pattern or a string. Only
|
# The optional +pattern+ parameter is a pattern or a string. Only
|
||||||
# input strings that match the pattern or start with the string
|
# input strings that match the pattern or start with the string
|
||||||
# are included in the output hash.
|
# are included in the output hash.
|
||||||
#
|
#
|
||||||
# abbr = %w{ fast boat day }.abbrev(/^.a.*$/)
|
# %w{ fast boat day }.abbrev(/^.a/)
|
||||||
# abbr #=> {"fas"=>"fast","fa"=>"fast",
|
# #=> {"fas"=>"fast", "fa"=>"fast", "da"=>"day",
|
||||||
# "da"=>"day", "fast"=>"fast", "day"=>"day"}
|
# "fast"=>"fast", "day"=>"day"}
|
||||||
#
|
#
|
||||||
# See also Abbrev.abbrev
|
# See also Abbrev.abbrev
|
||||||
def abbrev(pattern = nil)
|
def abbrev(pattern = nil)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче