るりまサーチ

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

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p
  5. dsa p

ライブラリ

キーワード

検索結果

Object#respond_to?(name, include_all = false) -> bool (6114.0)

オブジェクトがメソッド name を持つとき真を返します。

...メソッド name に応答できることをいいます。

Windows での Process.fork や GNU/Linux での File.lchmod の
ような NotImplementedError が発生する場合は false を返します。

※ NotImplementedError が発生する場合に false を返すのは
Rubyの組み込み...
...otImplementedError が発生する場合は true を返します。

メソッドが定義されていない場合は、Object#respond_to_missing? を呼
び出してその結果を返します。

@param name Symbol または文字列で指定するメソッド名です。

@param include_all priva...
... protected メソッドを確認の対象に
含めるかを true か false で指定します。省略した場合
は false(含めない) を指定した事になります。

//emlist[][ruby]{
class F
def hello
"Bonjour"
end
end

class D
p
rivate...

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

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

...数 args です。


@param method メソッド名の文字列かシンボルです。
@param 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...
...dified
a = [1, 2, 3]
p
(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_...
...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.first(4) # => [1, 1, 1, 2]
enum.size...

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

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

...数 args です。


@param method メソッド名の文字列かシンボルです。
@param 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...
...dified
a = [1, 2, 3]
p
(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_...
...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.first(4) # => [1, 1, 1, 2]
enum.size...

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

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

...数 args です。


@param method メソッド名の文字列かシンボルです。
@param 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...
...dified
a = [1, 2, 3]
p
(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_...
...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.first(4) # => [1, 1, 1, 2]
enum.size...

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

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

...数 args です。


@param method メソッド名の文字列かシンボルです。
@param 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...
...dified
a = [1, 2, 3]
p
(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_...
...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.first(4) # => [1, 1, 1, 2]
enum.size...

絞り込み条件を変える