るりまサーチ

最速Rubyリファレンスマニュアル検索!
5437件ヒット [1-100件を表示] (0.189秒)
トップページ > クエリ:I[x] > クエリ:l[x] > クエリ:Class[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

クラス

キーワード

検索結果

<< 1 2 3 ... > >>

Class#superclass -> Class | nil (36519.0)

自身のスーパークラスを返します。

...//emlist[例][ruby]{
File.superclass #=> IO
I
O.superclass #=> Object
class
Foo; end
class
Bar < Foo; end
Bar.superclass #=> Foo
Object.superclass #=> BasicObject
//}

ただし BasicObject.superclass は nil を返します。

//emlist[例][ruby]{
BasicObject....
...superclass #=> nil
//}...
...superclass #=> nil
//}

@see Class#subclasses...

Class#inherited(subclass) -> () (30336.0)

クラスのサブクラスが定義された時、新しく生成されたサブクラスを引数 にインタプリタから呼び出されます。このメソッドが呼ばれるタイミングは クラス定義文の実行直前です。

...ubclass プログラム内で新たに定義された自身のサブクラスです。

//emlist[例][ruby]{
class
Foo
def Foo.inherited(subclass)
puts "class \"#{self}\" was inherited by \"#{subclass}\""
end
end
class
Bar < Foo
puts "executing class body"
end

# => class "Foo" was inherit...
...ed by "Bar"
# executing class body
//}...

Digest::Class (27000.0)

IRB::ExtendCommandBundle.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases) -> object (26419.0)

irb に cmd_name で指定したメソッドが実行できるように拡張します。

...
i
rb に cmd_name で指定したメソッドが実行できるように拡張します。

@param cmd_name メソッド名を Symbol か文字列で指定します。
cmd_class で指定するクラスの execute メソッドとして定
義してある必要があ...
...param cmd_class 指定した拡張が定義されたクラス名を Symbol
String、Class のいずれかで指定します。
なお、このクラスは IRB::ExtendCommand 以下で定義
する必要があります。

@param load_file 指定...
...require されます。

@param aliases cmd_name の別名を Symbol とフラグの配列で指定しま
す。複数指定する事ができます。フラグは
I
RB::ExtendCommandBundle::NO_OVERRIDE、
I
RB::ExtendCommandBundle::OVERRIDE_PRIVATE_ONLY、...

static VALUE rb_class_superclass(VALUE klass) (24500.0)

絞り込み条件を変える

Integer#to_bn -> OpenSSL::BN (23112.0)

Integer を同じ数を表す OpenSSL::BN のオブジェクトに 変換します。

...
I
nteger を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'pp'
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
clas...
...s Integer
def to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...
...
I
nteger を同じ数を表す OpenSSL::BN のオブジェクトに
変換します。

//emlist[][ruby]{
require 'openssl'

pp 5.to_bn #=> #<OpenSSL::BN 5>
pp (-5).to_bn #=> #<OpenSSL::BN -5>
//}

なお、実装は、以下のようになっています。

//emlist[][ruby]{
class
Integer
d...
...ef to_bn
OpenSSL::BN::new(self)
end
end
//}

@see OpenSSL::BN.new, OpenSSL::BN#to_i...

TracePoint#defined_class -> Class | module (21550.0)

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

.../emlist[例][ruby]{
class
C; 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...

ARGF.class#internal_encoding -> Encoding | nil (21412.0)

ARGF から読み込んだ文字列の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。

...nil を返します。

まだ読み込み処理を始めていない場合は Encoding.default_external を返します。

ARGF.class#set_encoding で設定します。


例:
# $ ruby -Eutf-8 test.rb

# test.rb
ARGF.internal_encoding # => #<Encoding:UTF-8>
ARGF.set_encoding('u...
...tf-8','ascii')
ARGF.internal_encoding # => #<Encoding:US-ASCII>

例:
ARGF.binmode
ARGF.internal_encoding # => nil

@see IO, ARGF.class#external_encoding...

Module#class_variable_defined?(name) -> bool (21331.0)

name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。

...name Symbol か String を指定します。

//emlist[例][ruby]{
class
Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_defined?('@@bar') #=> false
//}...

Module#class_variables(inherit = true) -> [Symbol] (21331.0)

クラス/モジュールに定義されているクラス変数の名前の配列を返します。

...m inherit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。

//emlist[例][ruby]{
class
One
@@var1 = 1
end
class
Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variabl...
...es # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}

@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants...

絞り込み条件を変える

<< 1 2 3 ... > >>