るりまサーチ

最速Rubyリファレンスマニュアル検索!
367件ヒット [101-200件を表示] (0.027秒)

別のキーワード

  1. _builtin each_object
  2. objectspace each_object
  3. object send
  4. json object
  5. object to_enum

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 > >>

Kernel.#open(file, mode_enc = "r", perm = 0666) {|io| ... } -> object (103.0)

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

ブロックが与えられた場合、指定されたファイルをオープンし、
生成した IO オブジェクトを引数としてブロックを実行します。
ブロックの終了時や例外によりブロックを脱出するとき、
ファイルをクローズします。ブロックを評価した結果を返します。

ファイル名 file が `|' で始まる時には続く文字列をコマンドとして起動し、
コマンドの標準入出力に対してパイプラインを生成します

ファイル名が "|-" である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を...

Kernel.#open(name, mode = &#39;r&#39;, perm = nil, options = {}) {|ouri| ...} -> object (103.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...ock) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まって...
...ram mode モードを文字列で与えます。Kernel.#open と同じです。

@param perm open(2) の第 3 引数のように、ファイルを生成する場合のファイルのパーミッションを
整数で指定します。Kernel.#open と同じです

@param options ハッシ...
...uby2.7以降、open-uriにより拡張されたKernel.openでURLを開くときにwarningが表示されるようになりました。

require 'open-uri'
open("http://www.ruby-lang.org/") {|f|
# ...
}
#=> warning: calling URI.open via Kernel#open is deprecated, call URI.open directly or...

Kernel.#pp(*obj) -> object (103.0)

指定されたオブジェクト obj を標準出力に見やすい形式(プリティプリント)で出力します。 obj それぞれを引数として PP.pp を呼ぶことと同等です。

指定されたオブジェクト obj を標準出力に見やすい形式(プリティプリント)で出力します。
obj それぞれを引数として PP.pp を呼ぶことと同等です。


@param obj 表示したいオブジェクトを指定します。

//emlist[例][ruby]{
require 'pp'

b = [1, 2, 3] * 4
a = [b, b]
a << a
pp a

#=> [[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
# [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
# [...]]
//}

@see PP.p...
指定されたオブジェクト obj を標準出力に見やすい形式(プリティプリント)で出力します。
obj それぞれを引数として PP.pp を呼ぶことと同等です。

初回呼び出し時に自動的に pp を require します。

@param obj 表示したいオブジェクトを指定します。

//emlist[例][ruby]{
require 'pp'

b = [1, 2, 3] * 4
a = [b, b]
a << a
pp a

#=> [[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
# [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2,...

Kernel.#putc(ch) -> object (103.0)

文字 ch を 標準出力 $stdout に出力します。

文字 ch を 標準出力 $stdout に出力します。

ch が数値なら 0 〜 255 の範囲の対応する文字を出力します。
ch が文字列なら、その先頭1文字を出力します。
どちらでもない場合は、ch.to_int で整数に変換を試みます。

@param ch 出力する文字です。数または文字列で指定します。
@return ch を返します
@raise RangeError Bignum を引数にした場合に発生します。
@raise IOError 標準出力が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
@...

Kernel.#lambda -> Proc (20.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しない proc は、Ruby 2.7 では...
...pturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出し...
...生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成しますが、
生成された手...

絞り込み条件を変える

Kernel.#lambda { ... } -> Proc (20.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しない proc は、Ruby 2.7 では...
...pturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出し...
...生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成しますが、
生成された手...

Kernel.#proc -> Proc (20.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しない proc は、Ruby 2.7 では...
...pturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出し...
...生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成しますが、
生成された手...

Kernel.#proc { ... } -> Proc (20.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しない proc は、Ruby 2.7 では...
...pturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出し...
...生します。][ruby]{
pr = Proc.new { break }
(1..5).each(&pr)
//}

===[a:lambda_proc] lambda と proc と Proc.new とイテレータの違い

Kernel
.#lambda と Proc.new はどちらも Proc クラスのインスタンス(手続きオブジェクト)を生成しますが、
生成された手...

Kernel.#Array(arg) -> Array (14.0)

引数を配列(Array)に変換した結果を返します。

...します。

@param arg 変換対象のオブジェクトです。
@raise TypeError to_ary, to_a の返り値が配列でなければ発生します

//emlist[例][ruby]{
p Array({:it => 3}) #=> [[:it, 3]]
p Array(nil) #=> []
p Array("fefe") #=> ["fefe"]
//}

@see Object#to_a,Object#to_ary,Array...

Kernel.#Float(arg) -> Float (14.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...#=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10") #=> 10.0
p Float("10...

絞り込み条件を変える

Kernel.#Float(arg, exception: true) -> Float | nil (14.0)

引数を浮動小数点数(Float)に変換した結果を返します。

...#=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88

p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (TypeError)

p Float("10") #=> 10.0
p Float("10...

Kernel.#Integer(arg, base = 0) -> Integer (14.0)

引数を整数 (Fixnum,Bignum) に変換した結果を返します。

...teger(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010")...

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (14.0)

引数を整数 (Fixnum,Bignum) に変換した結果を返します。

...teger(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010")...
<< < 1 2 3 4 > >>