るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. zlib end

モジュール

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

Object#public_send(name, *args) -> object (6103.0)

オブジェクトの public メソッド name を args を引数にして呼び出し、メソッ ドの実行結果を返します。

...行結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

//emlist[][ruby]{
1.public_send(:+, 2) # => 3
//}

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

@param args 呼び出すメソッドに渡す引数で...
...しなかった場合に発生します。

@raise NoMethodError protected メソッドや private メソッドに対して実行
した場合に発生します。

//emlist[][ruby]{
1.public_send(:puts, "hello") # => NoMethodError
//}

@see BasicObject#__send__, Object#send...

Object#public_send(name, *args) { .... } -> object (6103.0)

オブジェクトの public メソッド name を args を引数にして呼び出し、メソッ ドの実行結果を返します。

...行結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

//emlist[][ruby]{
1.public_send(:+, 2) # => 3
//}

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

@param args 呼び出すメソッドに渡す引数で...
...しなかった場合に発生します。

@raise NoMethodError protected メソッドや private メソッドに対して実行
した場合に発生します。

//emlist[][ruby]{
1.public_send(:puts, "hello") # => NoMethodError
//}

@see BasicObject#__send__, Object#send...

String#prepend(*arguments) -> String (6103.0)

複数の文字列を先頭に破壊的に追加します。

...列を先頭に破壊的に追加します。

@param arguments 追加したい文字列を指定します。

//emlist[例][ruby]{
a = "!!!"
a.prepend # => "!!!"
a # => "!!!"

a = "!!!"
a.prepend "hello ", "world" # => "hello world!!!"
a # => "hello world!!!"
//}...

String#prepend(other_str) -> String (6103.0)

文字列 other_str を先頭に破壊的に追加します。

...文字列 other_str を先頭に破壊的に追加します。

@param other_str 追加したい文字列を指定します。

//emlist[例][ruby]{
a = "world"
a.prepend("hello ") # => "hello world"
a # => "hello world"
//}...

Thread#pending_interrupt?(error = nil) -> bool (6103.0)

self の非同期例外のキューが空かどうかを返します。

...self の非同期例外のキューが空かどうかを返します。

@param error 対象の例外クラスを指定します。


@see Thread.pending_interrupt?...

絞り込み条件を変える

Range#last(n) -> [object] (3010.0)

最後の n 要素を返します。範囲内に要素が含まれない場合は空の配列を返します。

...の数を指定した場合に発生します。

[注意] 引数を省略して実行した場合は、終端を含むかどうか
(Range#exclude_end? の戻り値)に関わらず終端の要素を返す事に注意し
てください。

//emlist[例][ruby]{
(10..20).last(3) # => [18, 19, 20]
(1...

Range#last -> object (3005.0)

終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。

終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。

//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}

@see Range#begin

Array#push(*obj) -> self (3003.0)

指定された obj を順番に配列の末尾に追加します。 引数を指定しなければ何もしません。

指定された obj を順番に配列の末尾に追加します。
引数を指定しなければ何もしません。

@param obj 自身に追加したいオブジェクトを指定します。

//emlist[例][ruby]{
array = [1, 2, 3]
array.push 4
array.push [5, 6]
array.push 7, 8
p array # => [1, 2, 3, 4, [5, 6], 7, 8]
//}

@see Array#pop, Array#shift, Array#unshift, Array#<<

Array#unshift(*obj) -> self (3003.0)

指定された obj を引数の最後から順番に配列の先頭に挿入します。 引数を指定しなければ何もしません。

指定された obj を引数の最後から順番に配列の先頭に挿入します。
引数を指定しなければ何もしません。

@param obj 自身に追加したいオブジェクトを指定します。

//emlist[例][ruby]{
arr = [1,2,3]
arr.unshift 0
p arr #=> [0, 1, 2, 3]
arr.unshift [0]
p arr #=> [[0], 0, 1, 2, 3]
arr.unshift 1, 2
p arr #=> [1, 2, [0], 0, 1, 2, 3]
//}

@see A...

Object#singleton_methods(inherited_too = true) -> [Symbol] (99.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...を返します。

inherited_too が真のときは継承した特異メソッドを含みます。
継承した特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタ...
...vate_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end


Foo = Class.new(Parent)

class <<Foo
private; def private_class_foo() end
protected; def protected_class_foo() end
public; def public_class_foo() end
end


module Bar
pri...
...vate; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end


obj = Foo.new
class <<obj
include Bar
private; def private_self() end
protected; def protected_self() end
public; def public_self() end
end


# あるオブジェクトの...

絞り込み条件を変える

Module#autoload(const_name, feature) -> nil (81.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...d する対象を指定する。

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar
end

end

# ----- end of /tmp/foo.rb ----

class Foo
autoload :Bar, '/tmp/foo'
end

p Foo::Bar #=> Foo::Bar
//}

以下のようにモジュールを明示的にレシーバとして呼び...
...出すこともできます。

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar
end
end

# ----- end of /tmp/foo.rb ----

class Foo
end

Foo.autoload :Bar, '/tmp/foo'
p Foo::Bar #=> Foo::Bar
//}

以下のように、autoload したライブラリがネストした定数...
...(警告メッ
セージが出ています)。

//emlist[例][ruby]{
# ------- /tmp/bar.rb ---------
class Bar
end

# ----- end of /tmp/bar.rb ----

class Foo
autoload :Bar, '/tmp/bar.rb'
end

p Foo::Bar
p Foo.autoload?(:Bar)
#=> -:4: warning: toplevel constant Bar referenced by Foo::Bar
# Bar
#...

TracePoint#defined_class -> Class | module (81.0)

メソッドを定義したクラスかモジュールを返します。

...def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end
.enable do
C.new.foo
end

//}

メソッドがモジュールで定義されていた場合も(include に関係なく)モジュー
ルを返します。

//emlist[例][ruby]{
module M; def foo; end; end
class C...
...; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end
.enable do
C.new.foo
end

//}

[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_func の 6 番目のブロックパ
...
...スではなく元のクラスを返します。

//emlist[例][ruby]{
class C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end
.enable do
C.foo
end

//}

Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。

@s...
<< < 1 2 3 4 5 ... > >>