るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

<< 1 2 > >>

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

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

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

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

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

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

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

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

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

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

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

Module#prepend_features(mod) -> self (12300.0)

Module#prepend から呼び出されるメソッドで、 prepend の処理の実体です。このメソッド自体は mod で指定した モジュール/クラスの継承チェインの先頭に self を追加します。

...Module#prepend から呼び出されるメソッドで、
prepend
の処理の実体です。このメソッド自体は mod で指定した
モジュール/クラスの継承チェインの先頭に self を追加します。

このメソッドを上書きすることで、prepend の処理を変...
...

@
param mod prepend を呼び出したモジュール
@
return mod が返されます

//emlist[例][ruby]{
class Recorder
RECORDS = []
end

module X
def self.prepend_features(mod)
Recorder::RECORDS << mod
end
end

class A
prepend
X
end

class B
include X
end

class C
prepend
X
en...
...d

Recorder::RECORDS # => [A, C]
//}

@
see Module#prepend, Module#prepended...

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

指定された 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 Arr...
...ay#push, Array#pop, Array#shift...

Object#is_a?(mod) -> bool (3031.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...ct#extendやModule#prepend
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に false を返します。

@
param mod クラスやモジュールなど、Moduleかそのサブクラスのインスタンスです。

//emlist[][ruby]...
...{
module M
end
class C < Object
include M
end
class S < C
end

obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M) # true
p obj.is_a?(Hash) # false
//}

@
see Object#instance_of?,Module#===,Object#class...

絞り込み条件を変える

Object#kind_of?(mod) -> bool (3031.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...ct#extendやModule#prepend
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に false を返します。

@
param mod クラスやモジュールなど、Moduleかそのサブクラスのインスタンスです。

//emlist[][ruby]...
...{
module M
end
class C < Object
include M
end
class S < C
end

obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M) # true
p obj.is_a?(Hash) # false
//}

@
see Object#instance_of?,Module#===,Object#class...

Module#<=(other) -> bool | nil (137.0)

比較演算子。self が other の子孫であるか、self と other が 同一クラスである場合、 true を返します。 self が other の先祖である場合、false を返します。

...算子。self が other の子孫であるか、self と other が
同一クラスである場合、 true を返します。
self が other の先祖である場合、false を返します。

継承関係にないクラス同士の比較では
nil を返します。

@
param other 比較対象のモ...
...

@
raise TypeError other がクラスやモジュールではない場合に発生します。

@
see Module#<

//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend
Foo
end

Bar.ancestors # => [Bar, Foo]
Foo <= Bar # => false
Bar <= Foo # => true

Baz.ancestors #...
...=> [Foo, Baz]
Foo <= Baz # => false
Baz <= Foo # => true

Foo <= Foo # => true
Foo <= Object # => nil
//}...

Module#>(other) -> bool | nil (137.0)

比較演算子。 self が other の先祖である場合、true を返します。 self が other の子孫か同一クラスである場合、false を返します。

...other の先祖である場合、true を返します。
self が other の子孫か同一クラスである場合、false を返します。

継承関係にないクラス同士の比較では
nil を返します。

@
param other 比較対象のモジュールやクラス

@
raise TypeError other...
...ます。

@
see Module#<

//emlist[例][ruby]{
module Awesome; end
module Included
include Awesome
end
module Prepended
prepend
Awesome
end

Included.ancestors # => [Included, Awesome]
Awesome > Included # => true
Included > Awesome # => false

Prepend
ed.ancestors # => [Awesome, Prepended]
Aweso...
...me > Prepended # => true
Prepend
ed > Awesome # => false

Awesome > Awesome # => false
Awesome > Object # => nil
//}...

Module#>=(other) -> bool | nil (137.0)

比較演算子。self が other の先祖か同一クラスである場合、 true を返します。 self が other の子孫である場合、false を返します。

...other の先祖か同一クラスである場合、 true を返します。
self が other の子孫である場合、false を返します。

継承関係にないクラス同士の比較では
nil を返します。

@
param other 比較対象のモジュールやクラス

@
raise TypeError other...
...

@
see Module#<

//emlist[例][ruby]{
module Foo; end
module Bar
include Foo
end
module Baz
prepend
Foo
end

Bar.ancestors # => [Bar, Foo]
Foo >= Bar # => true
Bar >= Foo # => false

Baz.ancestors # => [Foo, Baz]
Foo >= Baz # => true
Baz >= Foo # => false

Foo >= Foo # => true
Foo >= Object #...
<< 1 2 > >>