種類
- モジュール関数 (66)
- インスタンスメソッド (12)
- 特異メソッド (11)
- モジュール (11)
- ライブラリ (6)
クラス
- CSV (11)
モジュール
- Exception2MessageMapper (12)
- Kernel (66)
検索結果
先頭5件
-
CSV
. new(data , options = Hash . new) -> CSV (18220.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...aulty. You can use this limit to
prevent what are effectively DoS attacks on the parser. However, this
limit can cause a legitimate parse to fail and thus is set to +nil+, or off,
by default.
: :converters
CSV::Converters から取り出した名前の配列です。変換器が一つだ......e
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20">
end
//}
//emlist[......み][ruby]{
require "csv"
users =<<-EOS
id|first name|last name|age
1|taro|tanaka|20
2|jiro|suzuki|18
3|ami|sato|19
4|yumi|adachi|21
EOS
csv = CSV.new(users, headers: true, col_sep: "|")
p csv.class # => CSV
p csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20">... -
Exception2MessageMapper
# Fail(exception _ class = nil , *rest) -> () (18107.0) -
登録されている情報を使用して、例外を発生させます。
...eption :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。
Foo.Raise Foo::NewExcepti......onClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Kernel
. # fail -> () (6115.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...end
foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end
begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}
@see Kernel.#caller... -
Kernel
. # fail(error _ type , message = nil , backtrace = caller(0) , cause: $ !) -> () (6115.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...end
foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end
begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}
@see Kernel.#caller... -
Kernel
. # fail(message , cause: $ !) -> () (6115.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...end
foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end
begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}
@see Kernel.#caller... -
Kernel
. # raise -> () (3015.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...end
foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end
begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}
@see Kernel.#caller... -
Kernel
. # raise(error _ type , message = nil , backtrace = caller(0) , cause: $ !) -> () (3015.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...end
foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end
begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}
@see Kernel.#caller... -
Kernel
. # raise(message , cause: $ !) -> () (3015.0) -
例外を発生させます。 発生した例外は変数 $! に格納されます。また例外が 発生した時のスタックトレースは変数 $@ に格納され ます。発生した例外は rescue 節で捕捉できます。
...end
foo(4) #=> in method.in rescue.in method.in else.in ensure.
//}
//emlist[例3][ruby]{
class MyException
def exception(mesg=nil)
SecurityError.new(mesg)
end
end
begin
raise MyException.new
rescue SecurityError
p $! #=> #<SecurityError: SecurityError>
end
//}
@see Kernel.#caller... -
Exception2MessageMapper
# Raise(exception _ class = nil , *rest) -> () (3007.0) -
登録されている情報を使用して、例外を発生させます。
...eption :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。
Foo.Raise Foo::NewExcepti......onClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
e2mmap (36.0)
-
例外クラスに特定のエラーメッセージ用フォーマットを関連づけるためのライブラリです。
...extend Exception2MessageMapper
def_e2message ExistingExceptionClass, "message..."
def_exception :NewExceptionClass, "message...", StandardError
...
end
foo = Foo.new
foo.Fail ....
2. 何度も使いたい例外クラスは、クラスの代わりにモジュールで定義し......eMapper
def_e2message ExistingExceptionClass, "message..."
def_exception :NewExceptionClass, "message...", StandardError
...
end
class Foo
include ErrorMod
...
end
foo = Foo.new
foo.Fail ....
3. 例外を設定したクラスのインスタンス以外から例外......def_e2message ExistingExceptionClass, "message..."
def_exception :NewExceptionClass, "message...", StandardError
...
end
class Foo
extend Exception2MessageMapper
include ErrorMod
...
end
Foo.Fail NewExceptionClass, arg...
Foo.Fail ExistingExceptionClass, arg...... -
OpenSSL
:: OCSP (30.0) -
OCSP(Online Certificate Status Protocol)を取り扱うための モジュールです。OCSP は 2560 で定義されています。
...ト)
store # 信頼している証明書ストア
cid = OpenSSL::OCSP::CertificateId.new(subject, issuer)
req = OpenSSL::OCSP::Request.new
req.add_certid(cid)
req.add_nonce
http = Net::HTTP.new('ocsp.example.com', 80)
httpres = http.post("/", req.to_der, 'content-type' => 'applicati......on/ocsp-request')
raise "HTTP error" if !httpres.kind_of?(Net::HTTPOK)
res = OpenSSL::OCSP::Response.new(httpres.body)
puts "Response status: #{res.status_string}"
exit if res.status != OpenSSL::OCSP::RESPONSE_STATUS_SUCCESSFUL
basic_resp = res.basic
raise "nonce error" unless [-1, 1...