1294件ヒット
[1-100件を表示]
(0.134秒)
ライブラリ
- ビルトイン (810)
-
json
/ add / exception (11) -
net
/ http (55) - openssl (11)
- optparse (22)
- shell (18)
-
shell
/ command-processor (18) -
shell
/ filter (18) - socket (33)
- strscan (55)
- thread (12)
- zlib (231)
クラス
- Array (33)
- BasicSocket (11)
-
Encoding
:: Converter (44) -
Encoding
:: InvalidByteSequenceError (22) - Exception (128)
- FrozenError (5)
- KeyError (14)
- LoadError (11)
- LocalJumpError (22)
- MatchData (44)
- Module (11)
- NameError (40)
-
Net
:: HTTPResponse (11) - NoMethodError (11)
- Object (11)
-
OpenSSL
:: SSL :: SSLContext (11) - OptionParser (22)
- Range (45)
- Regexp (22)
- Shell (18)
-
Shell
:: CommandProcessor (18) -
Shell
:: Filter (18) - SignalException (22)
- StopIteration (11)
- String (132)
- StringScanner (55)
- SystemCallError (11)
- SystemExit (22)
- Thread (55)
-
Thread
:: Queue (33) -
Thread
:: SizedQueue (33) - TracePoint (11)
- UDPSocket (11)
- UNIXServer (11)
- UncaughtThrowError (30)
-
Zlib
:: GzipReader (198) -
Zlib
:: GzipWriter (22) -
Zlib
:: Inflate (11)
モジュール
- Comparable (10)
-
Net
:: HTTPExceptions (11) -
Net
:: HTTPHeader (33)
キーワード
- == (11)
- =~ (11)
- [] (95)
- accept (11)
-
accept
_ nonblock (11) - args (11)
- backtrace (11)
-
backtrace
_ locations (11) -
ca
_ file= (11) - cause (11)
- clamp (10)
- close (11)
- cover? (12)
- deq (22)
- each (22)
-
each
_ byte (22) -
each
_ line (22) - end (11)
- eof (11)
- eof? (11)
- errno (11)
-
error
_ bytes (11) - exception (22)
- exit (11)
-
exit
_ value (11) - fetch (66)
- finish (11)
- first (22)
-
fixed
_ encoding? (11) - getc (11)
- getpeereid (11)
- gets (11)
-
incomplete
_ input? (11) -
initialize
_ copy (11) - inspect (11)
- key (7)
- kill (11)
- lineno (11)
- lineno= (11)
-
local
_ variables (9) - mkdir (18)
- name (11)
- offset (22)
- path (11)
- peek (11)
- peep (11)
- pointer= (11)
- pop (22)
- pos= (11)
-
primitive
_ convert (44) -
public
_ constant (11) - raise (11)
-
raised
_ exception (11) - read (11)
- readchar (11)
- readline (11)
- readlines (11)
- reason (11)
- receiver (21)
-
recvfrom
_ nonblock (11) - reject (11)
- response (11)
- result (11)
- rewind (11)
-
set
_ backtrace (11) -
set
_ dictionary (11) - shift (22)
- signm (11)
- signo (11)
- slice (66)
- status (11)
- success? (11)
- tag (10)
- terminate (11)
- test (18)
-
to
_ json (11) -
to
_ s (32) - ungetc (11)
- unscan (11)
- value (21)
検索結果
先頭5件
-
Range
# begin -> object (18172.0) -
始端の要素を返します。 始端を持たない範囲オブジェクトの場合、begin はnilを返しますが, first は例外 RangeError が発生します。
...トの場合、begin はnilを返しますが, first は例外 RangeError が発生します。
//emlist[例][ruby]{
# 始端を持つ場合
p (1..5).begin # => 1
p (1..0).begin # => 1
p (1..5).first # => 1
p (1..0).first # => 1
# 始端を持たない場合
p (..5).begin #=> nil
p (..5).first #=>... -
MatchData
# begin(n) -> Integer | nil (18168.0) -
n 番目の部分文字列先頭のオフセットを返します。
...。
@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) # =... -
Exception
# exception(error _ message) -> Exception (9207.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラーメッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# .........# 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
OptionParser
# accept(klass , pat = / . * / ) {|str| . . . } -> () (9113.0) -
OptionParser.accept と同様ですが、 登録したブロックはレシーバーに限定されます。
...OptionParser.accept と同様ですが、
登録したブロックはレシーバーに限定されます。
@param klass クラスオブジェクトを与えます。
@param pat match メソッドを持ったオブジェクト(Regexp オブジェクトなど)を与えます。
//emlist[例][rub......y]{
require "optparse"
require "time"
opts = OptionParser.new
opts.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end
opts.on("-t", "--time [TIME]", Time) do |time|
p time.class # => Time
end
opts.parse!(ARGV)
//}... -
Exception
# exception -> self (9107.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラーメッセージを表す文字列を指定します。
//emlist[例][ruby]{
begin
# .........# 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
Net
:: HTTPExceptions # response -> Net :: HTTPResponse (6207.0) -
例外の原因となったレスポンスオブジェクトを返します。
...レスポンスオブジェクトを返します。
//emlist[例][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.response # => #<Net::HTTPNotFound 404 Not Found readbody=true>
end
//}... -
TracePoint
# raised _ exception -> Exception (6207.0) -
発生した例外を返します。
...eError :raise イベントのためのイベントフックの外側で実行し
た場合に発生します。
//emlist[例][ruby]{
trace = TracePoint.new(:raise) do |tp|
tp.raised_exception # => #<ZeroDivisionError: divided by 0>
end
trace.enable
begin
0/0
rescue
end
//}... -
StringScanner
# peek(bytes) -> String (6179.0) -
スキャンポインタから長さ bytes バイト分だけ文字列を返します。
...test string')
s.peek(4) # => "test"
//}
また、このメソッドを実行してもスキャンポインタは移動しません。
StringScanner#peep は将来のバージョンでは削除される予定です。
代わりに StringScanner#peek を使ってください。
@param bytes 0 以......st string')
p s.peek(4) # => "test"
p s.peek(20) # => "test string"
p s.peek(0) # => ""
begin
s.peek(-1)
rescue ArgumentError => err
puts err # negative string size (or size too big)
end
p s.scan(/\w+/) # => "test"
p s.scan(/\s+/) # => " "
p s.scan(/\w+/) # => "string"
p s.peek(4)......# => ""
# このメソッドを実行してもスキャンポインタは移動しません。
s = StringScanner.new('test string')
p s.peek(4) # => "test"
p s.peek(4) # => "test"
p s.scan(/\w+/) # => "test"
p s.peek(4) # => " str"
p s.peek(4) # => " str"
//}... -
StringScanner
# peep(bytes) -> String (6179.0) -
スキャンポインタから長さ bytes バイト分だけ文字列を返します。
...test string')
s.peek(4) # => "test"
//}
また、このメソッドを実行してもスキャンポインタは移動しません。
StringScanner#peep は将来のバージョンでは削除される予定です。
代わりに StringScanner#peek を使ってください。
@param bytes 0 以......st string')
p s.peek(4) # => "test"
p s.peek(20) # => "test string"
p s.peek(0) # => ""
begin
s.peek(-1)
rescue ArgumentError => err
puts err # negative string size (or size too big)
end
p s.scan(/\w+/) # => "test"
p s.scan(/\s+/) # => " "
p s.scan(/\w+/) # => "string"
p s.peek(4)......# => ""
# このメソッドを実行してもスキャンポインタは移動しません。
s = StringScanner.new('test string')
p s.peek(4) # => "test"
p s.peek(4) # => "test"
p s.scan(/\w+/) # => "test"
p s.peek(4) # => " str"
p s.peek(4) # => " str"
//}... -
StringScanner
# pointer=(n) (6149.0) -
スキャンポインタのインデックスを n にセットします。
...スキャンポインタのインデックスを n にセットします。
@param n 整数で、バイト単位で指定します。
負数を指定すると文字列の末尾からのオフセットとして扱います。
@raise RangeError マッチ対象の文字列の長さを超え......tringScanner.new('test string')
p s.scan(/\w+/) # => "test"
p s.pos = 1 # => 1
p s.scan(/\w+/) # => "est"
p s.pos = 7 # => 7
p s.scan(/\w+/) # => "ring"
begin
s.pos = 20
rescue RangeError => err
puts err #=> index out of range
end
p s.pos = -4 # => -4
p s.scan(/\w+/) # => "ring"
//}...