るりまサーチ

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

別のキーワード

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

検索結果

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

Module#private_constant(*name) -> self (32.0)

name で指定した定数の可視性を private に変更します。

...変更します。

@
param name 0 個以上の String か Symbol を指定します。

@
raise NameError 存在しない定数を指定した場合に発生します。

@
return self を返します。

@
see Module#public_constant, Object#untrusted?

//emlist[例][ruby]{
module
Foo
BAR = 'bar'
c...
...private に変更します。

@
param name 0 個以上の String か Symbol を指定します。

@
raise NameError 存在しない定数を指定した場合に発生します。

@
return self を返します。

@
see Module#public_constant

//emlist[例][ruby]{
module
Foo
BAR = 'bar'
class Ba...

Module#public_constant(*name) -> self (32.0)

name で指定した定数の可視性を public に変更します。

...視性を public に変更します。

@
param name 0 個以上の String か Symbol を指定します。

@
raise NameError 存在しない定数を指定した場合に発生します。

@
return self を返します。

//emlist[例][ruby]{
module
SampleModule
class SampleInnerClass
end

#...
...SampleModule::SampleInnerClass
rescue => e
e # => #<NameError: private constant SampleModule::SampleInnerClass referenced>
end

module
SampleModule
# => 非公開クラスであることは承知で利用するために public にする
public_constant :SampleInnerClass
end

SampleModule::Samp...
...leInnerClass # => SampleModule::SampleInnerClass
//}

@
see Module#private_constant, Object#untrusted?...
...leInnerClass # => SampleModule::SampleInnerClass
//}

@
see Module#private_constant...

Module#refine(klass) { ... } -> Module (32.0)

引数 klass で指定したクラスまたはモジュールだけに対して、ブロックで指定した機能を提供で きるモジュールを定義します。定義した機能は Module#refine を使用せずに直 接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。 そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。

...モジュールだけに対して、ブロックで指定した機能を提供で
きるモジュールを定義します。定義した機能は Module#refine を使用せずに直
接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。
そのた...
...ださい。

* https://magazine.rubyist.net/articles/0041/0041-200Special-refinement.html
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html

定義した機能は main.using, Module#using を実行した場合のみ
有効になります。

@
param klass 拡張する対象のク...
...ラスまたはモジュールを指定します。

@
return ブロックで指定した機能を持つ無名のモジュールを返します。

//emlist[例][ruby]{
class C
def foo
puts "C#foo"
end
end

module
M
refine C do
def foo
puts "C#foo in M"
end
end
end

x = C.ne...

Module#remove_class_variable(name) -> object (32.0)

引数で指定したクラス変数を取り除き、そのクラス変数に設定さ れていた値を返します。

...、そのクラス変数に設定さ
れていた値を返します。

@
param name String または Symbol を指定します。

@
return 引数で指定されたクラス変数に設定されていた値を返します。

@
raise NameError 引数で指定されたクラス変数がそのモジュ...
...ールやクラスに定義されていない場合に発生します。

//emlist[例][ruby]{
class Foo
@
@foo = 1
remove_class_variable(:@@foo) # => 1
p @@foo # => uninitialized class variable @@foo in Foo (NameError)
end
//}

@
see Module#remove_const, Object#remove_instance_variable...

Module#remove_const(name) -> object (32.0)

name で指定した定数を取り除き、その定数に設定されていた値を 返します。

...を取り除き、その定数に設定されていた値を
返します。

@
param name String または Symbol を指定します。

@
return 引数で指定された定数に設定されていた値を返します。

@
raise NameError 引数で指定された定数がそのモジュールやク...
...指定した(まだロードしてない)定数を含めて削除する事ができます。

取り除かれた定数は参照できなくなりますが、消える訳ではないので注意して
使用してください。

@
see Module#remove_class_variable, Object#remove_instance_variable...

絞り込み条件を変える

Module#remove_method(*name) -> self (32.0)

インスタンスメソッド name をモジュールから削除します。

...します。

Ruby
1.8.0 以降は複数のメソッド名を指定して一度に削除できます。

@
param name 0 個以上の String か Symbol を指定します。

@
raise NameError 指定したメソッドが定義されていない場合に発生します。

//emlist[例][ruby]{
class C...
...def foo
end

remove_method :foo
remove_method :no_such_method # 例外 NameError が発生
end
//}

@
see Module#undef_method...

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

比較演算子。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.anc...

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

比較演算子。 self が 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 Awe...

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

比較演算子。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.anc...
<< < 1 2 3 4 5 ... > >>