るりまサーチ

最速Rubyリファレンスマニュアル検索!
688件ヒット [1-100件を表示] (0.154秒)

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Object#enum_for(method = :each, *args) -> Enumerator (21013.0)

Enumerator.new(self, method, *args) を返します。

...am args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[...
...ば size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n.times { yield *val }
end
end
end

%
i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.fir...

Object#enum_for(method = :each, *args) {|*args| ... } -> Enumerator (21013.0)

Enumerator.new(self, method, *args) を返します。

...am args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[...
...ば size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n.times { yield *val }
end
end
end

%
i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.fir...

Object#to_enum(method = :each, *args) -> Enumerator (21013.0)

Enumerator.new(self, method, *args) を返します。

...am args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[...
...ば size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n.times { yield *val }
end
end
end

%
i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.fir...

Object#to_enum(method = :each, *args) {|*args| ... } -> Enumerator (21013.0)

Enumerator.new(self, method, *args) を返します。

...am args 呼び出すメソッドに渡される引数です。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[...
...ば size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n.times { yield *val }
end
end
end

%
i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.fir...

String#%(args) -> String (18251.0)

printf と同じ規則に従って args をフォーマットします。

...ist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "i = %o" % 10 # => "i = 12"

p "i = %#d" % 10 # => "i = 10"
p "i = %#x" % 10 # => "i = 0xa"
p "i = %#o" % 10 # => "i = 012"

p "%d" % 10 # => "10"
p "%d,%o" % [10, 10] # => "10,12...
...ないこと、2進数の指示子(%b, %B)が存在すること、sprintf のすべての方言をサ
ポートしていないこと(%': 3桁区切り)などの違いがあります。

Ruby には整数の大きさに上限がないので、%b, %B, %o, %x, %X
に負の数を与えると (左側に...
...るためには %+x、% x のように指定します。


以下は sprintf フォーマットの書式です。[] で囲まれた部分は省略可
能であることを示しています。

%
[nth$][フラグ][幅][.精度]指示子
%
[<name>][フラグ][幅][.精度]指示子

`%' 自身を出...

絞り込み条件を変える

BasicObject#method_missing(name, *args) -> object (3138.0)

呼びだされたメソッドが定義されていなかった時、Rubyインタプリタがこのメソッド を呼び出します。

...({:English => %w(zero one two), :Esperanto => %w(nulo unu du)})
dic.find_2_in :Esperanto #=> "du"
//}

[注意] このメソッドを override する場合は対象のメソッド名に対して
Object
#respond_to? が真を返すようにしてください。
そのためには、Object#respond_to_m...
...issing? も同様に override する必
要があります。

@see Object#respond_to?, Object#respond_to_missing?...

Array#minmax -> [object, object] (211.0)

自身の各要素のうち最小の要素と最大の要素を 要素とするサイズ 2 の配列を返します。

...とを仮定し
ています。二つ目の形式では、要素同士の比較をブロックを用いて行います。

//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax #=> ["albatross", "horse"]
a.minmax{|a,b| a.length <=> b.length } #=> ["dog", "albatr...

Array#minmax {|a, b| ... } -> [object, object] (211.0)

自身の各要素のうち最小の要素と最大の要素を 要素とするサイズ 2 の配列を返します。

...とを仮定し
ています。二つ目の形式では、要素同士の比較をブロックを用いて行います。

//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax #=> ["albatross", "horse"]
a.minmax{|a,b| a.length <=> b.length } #=> ["dog", "albatr...

Enumerable#minmax -> [object, object] (211.0)

Enumerable オブジェクトの各要素のうち最小の要素と最大の要素を 要素とするサイズ 2 の配列を返します。

...とを仮定しています。二つ目の形式では、要素同士の比較を
ブロックを用いて行います。

//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax #=> ["albatross", "horse"]
a.minmax{|a,b| a.length <=> b.length } #=> ["dog", "albatr...

Enumerable#minmax {|a, b| ... } -> [object, object] (211.0)

Enumerable オブジェクトの各要素のうち最小の要素と最大の要素を 要素とするサイズ 2 の配列を返します。

...とを仮定しています。二つ目の形式では、要素同士の比較を
ブロックを用いて行います。

//emlist[例][ruby]{
a = %w(albatross dog horse)
a.minmax #=> ["albatross", "horse"]
a.minmax{|a,b| a.length <=> b.length } #=> ["dog", "albatr...

絞り込み条件を変える

<< 1 2 3 ... > >>