ライブラリ
- ビルトイン (310)
- json (11)
- optparse (22)
- prettyprint (11)
- psych (25)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) - socket (11)
- time (55)
- zlib (44)
クラス
- Array (44)
-
Encoding
:: Converter (44) -
Enumerator
:: ArithmeticSequence (24) - Exception (11)
-
File
:: Stat (11) -
JSON
:: State (11) - LoadError (11)
- MatchData (44)
- OptionParser (22)
- PrettyPrint (11)
- Random (22)
- Regexp (11)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - StopIteration (11)
- SystemExit (11)
- Thread (22)
- Time (55)
- UDPSocket (11)
-
Zlib
:: GzipReader (33) -
Zlib
:: Inflate (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - == (6)
- Status (11)
- [] (33)
- accept (22)
-
backtrace
_ locations (11) -
check
_ circular? (11) - each (11)
-
each
_ byte (11) -
each
_ line (11) - end (17)
- exit (11)
- exit! (11)
- format (11)
-
handle
_ interrupt (11) - hash (6)
- httpdate (11)
- iso8601 (11)
-
last
_ match (11) - load (14)
- mkdir (18)
- offset (22)
- parse (11)
- path (11)
-
primitive
_ convert (44) - rand (22)
- rdoc (11)
-
recvfrom
_ nonblock (11) - require (11)
- result (11)
- rfc2822 (11)
- rfc822 (11)
-
ruby 1
. 6 feature (11) -
set
_ dictionary (11) - status (11)
- sticky? (11)
- terminate (11)
- xmlschema (11)
- 制御構造 (11)
検索結果
先頭5件
-
MatchData
# begin(n) -> Integer | nil (30337.0) -
n 番目の部分文字列先頭のオフセットを返します。
...nilを返します。
@param n 部分文字列を指定する数値。
@raise IndexError 範囲外の n を指定した場合に発生します。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.begin(0) # => 0
p $~.begin(1) # => 0
p $~.begin(2) # => 3
p $~.begin(3) # => nil......p $~.begin(4) # => `begin': index 4 out of matches (IndexError)
//}
@see MatchData#end... -
Enumerator
:: ArithmeticSequence # begin -> Numeric (27201.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Enumerator
:: ArithmeticSequence # begin -> Numeric | nil (27201.0) -
初項 (始端) を返します。
...初項 (始端) を返します。
@see Enumerator::ArithmeticSequence#end... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (15406.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...tion#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Date......aise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:i......n `<main>'"]
//}
@see Exception#backtrace... -
Array
# at(nth) -> object | nil (15206.0) -
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
...nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
@param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックス......トを指定した場合は to_int メソッドによる
暗黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [ "a", "b", "......c", "d", "e" ]
a[0] #=> "a"
a[1] #=> "b"
a[-1] #=> "e"
a[-2] #=> "d"
a[10] #=> nil
//}... -
Time
. httpdate(date) -> Time (9306.0) -
2616で定義されているHTTP-dateとしてdateをパースして Timeオブジェクトに変換します。
...るHTTP-dateとしてdateをパースして
Timeオブジェクトに変換します。
dateが2616に準拠していない、または
Timeクラスが指定された日時を表現できないときにArgumentErrorが
発生します。
@param date 2616で定義されているHTTP-dateとして......ます。
@raise ArgumentError dateが2616に準拠していない、または Timeクラスが指定された日時を表現できないときに発生します。
require 'time'
rfc2616_time = 'Sun, 31 Aug 2008 12:34:56 GMT'
t = Time.httpdate(rfc2616_time)
p t.kind_of?(Time) #=> true......non_rfc2616_time = 'San, 31 Aug 2008 12:34:56 GMT'
begin
Time.httpdate(non_rfc2616_time)
rescue ArgumentError => err
puts err #=> not RFC 2616 compliant date: "San, 31 Aug 2008 12:34:56 GMT"
end... -
SystemExit
# status -> Integer (9212.0) -
例外オブジェクトに保存された終了ステータスを返します。
...します。
終了ステータスは Kernel.#exit や SystemExit.new などで設定されます。
例:
begin
exit 1
rescue SystemExit => err
p err.status # => 1
end
begin
raise SystemExit.new(1, "dummy exit")
rescue SystemExit => err
p err.status # => 1
end... -
PrettyPrint
. format(output = & # 39;& # 39; , maxwidth = 79 , newline = "\n" , genspace = lambda{|n| & # 39; & # 39; * n}) {|pp| . . . } -> object (9206.0) -
PrettyPrint オブジェクトを生成し、それを引数としてブロックを実行します。 与えられた output を返します。
...rettyPrint オブジェクトを生成し、それを引数としてブロックを実行します。
与えられた output を返します。
以下と同じ働きをするもので簡便のために用意されています。
//emlist[][ruby]{
require 'prettyprint'
begin
pp = PrettyPrint.new......(output, maxwidth, newline, &genspace)
...
pp.flush
output
end
//}
@param output 出力先を指定します。output は << メソッドを持っていなければなりません。
@param maxwidth 行の最大幅を指定します。ただし、改行できないものが渡された場合......は、
実際の出力幅は maxwidth を越えることがあります。
@param newline 改行に使われます。
@param genspace 空白の生成に使われる Proc オブジェクトを指定します。
生成したい空白の幅を表す整数を引数と... -
Thread
# terminate -> self (9206.0) -
スレッドの実行を終了させます。終了時に ensure 節が実行されます。
...スレッドの実行を終了させます。終了時に ensure 節が実行されます。
ただし、スレッドは終了処理中(aborting)にはなりますが、
直ちに終了するとは限りません。すでに終了している場合は何もしません。このメソッドによ......#exit(0)
により終了します。
Kernel.#exit と違い例外 SystemExit を発生しません。
th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end
sleep 0.1
th1.kill
#=> "this will be displayed"
@see Kernel.#exit, Kernel.#exit!... -
Zlib
:: Inflate # set _ dictionary(string) -> String (9112.0) -
展開に用いる辞書を指定します。string を返します。 このメソッドは Zlib::NeedDict 例外が発生した直後のみ 有効です。詳細は zlib.h を参照して下さい。
...string を返します。
このメソッドは Zlib::NeedDict 例外が発生した直後のみ
有効です。詳細は zlib.h を参照して下さい。
@param string 展開に用いる辞書を文字列で指定します。
require 'zlib'
def case2(str, dict)
dez = Zlib::Deflate.new.......set_dictionary(dict)
comp_str = dez.deflate(str)
comp_str << dez.finish
comp_str.size
inz = Zlib::Inflate.new
begin
inz.inflate(comp_str)
rescue Zlib::NeedDict
end
# 展開に用いる辞書が必要です。
inz.set_dictionary(dict)
p inz.inflate(comp......_str)
end
dict = 'hoge_fuga_ugougo'
sset = [ dict, 'taeagbamike', 'ugotagma', 'fugebogya' ]
g = [ 0, 0, 0, 1, 1, 1, 0, 0, 0, 3, 3, 3, 0, 0, 1, 1,
0, 0, 0, 1, 2, 2, 0, 0, 0, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0]
str = g.collect{|m| sset.at(m)}.join("")
case2(str, dict)... -
File
:: Stat # sticky? -> bool (9106.0) -
stickyビットが立っている時に真を返します。
...stickyビットが立っている時に真を返します。
//emlist[][ruby]{
Dir.glob("/usr/bin/*") {|bd|
begin
if File::Stat.new(bd).sticky?
puts bd
end
rescue
end
}
#例
#...
#=> /usr/bin/emacs-21.4
#...
//}...