別のキーワード
キーワード
- !~ (12)
- <=> (12)
- == (12)
- === (12)
- =~ (9)
-
_ dump (12) - class (12)
- clone (12)
-
define
_ singleton _ method (24) - display (12)
- dup (12)
-
enum
_ for (24) - eql? (12)
- equal? (12)
- extend (12)
- freeze (12)
- frozen? (12)
- hash (12)
- initialize (12)
-
initialize
_ copy (12) - inspect (12)
-
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) -
is
_ a? (12) -
kind
_ of? (12) -
marshal
_ dump (12) -
marshal
_ load (12) - method (12)
- methods (12)
-
object
_ id (12) -
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
public
_ method (12) -
public
_ send (24) -
remove
_ instance _ variable (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) - send (24)
-
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ methods (12) - taint (9)
- tainted? (9)
- tap (8)
- then (14)
-
to
_ a (12) -
to
_ ary (12) -
to
_ enum (24) -
to
_ int (12) -
to
_ s (12) -
to
_ str (12) - trust (9)
- untaint (9)
- untrust (9)
- untrusted? (9)
-
yield
_ self (16)
検索結果
先頭5件
-
Object
# instance _ variables -> [Symbol] (132.0) -
オブジェクトのインスタンス変数名をシンボルの配列として返します。
...インスタンス変数名をシンボルの配列として返します。
//emlist[][ruby]{
obj = Object.new
obj.instance_eval { @foo, @bar = nil }
p obj.instance_variables
#=> [:@foo, :@bar]
//}
@see Object#instance_variable_get, Kernel.#local_variables, Kernel.#global_variables, Module.consta... -
Object
# marshal _ load(obj) -> object (132.0) -
Marshal.#load を制御するメソッドです。
...仕組みは Ruby 1.8.0 から導入されました。
これから書くプログラムでは _dump/_load ではなく
marshal_dump/marshal_load を使うべきです。
@param obj marshal_dump の返り値のコピーです。
@return 返り値は無視されます。
@see Object#marshal_dum... -
Object
# public _ method(name) -> Method (132.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を引数として与えると発生します。
//emlist[][ruby]{
1.public_method(......:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}
@see Object#method,Object#public_send,Module#public_instance_method... -
Object
# respond _ to _ missing?(symbol , include _ private) -> bool (132.0) -
自身が symbol で表されるメソッドに対し BasicObject#method_missing で反応するつもりならば真を返します。
...れるメソッドに対し
BasicObject#method_missing で反応するつもりならば真を返します。
Object#respond_to? はメソッドが定義されていない場合、
デフォルトでこのメソッドを呼びだし問合せます。
BasicObject#method_missing を override した......メソッドも
override されるべきです。
false を返します。
@param symbol メソッド名シンボル
@param include_private private method も含めたい場合に true が渡されます
//emlist[例][ruby]{
class Sample
def method_missing(name, *args)
if name =~ /^to_*/......end
end
def respond_to_missing?(sym, include_private)
(sym =~ /^to_*/) ? true : super
end
end
s = Sample.new
s.to_sample("sample args1", "sample args2")
s.respond_to?(:to_sample) # => true
s.respond_to?(:sample) # => false
//}
@see Object#respond_to?, BasicObject#method_missing... -
Object
# tainted? -> false (132.0) -
常に false を返します。 全てのオブジェクトは常に untainted 扱いになりました。
...常に false を返します。
全てのオブジェクトは常に untainted 扱いになりました。
このメソッドは Ruby 2.7から deprecated で、Ruby 3.2 で削除予定です。
@see Object#taint,Object#untaint... -
Object
# untaint -> self (132.0) -
何もせずに self を返します。
...何もせずに self を返します。
このメソッドは Ruby 2.7 から deprecated で、Ruby 3.2 で削除予定です。
@see Object#taint,Object#tainted?... -
Object
# eql?(other) -> bool (126.0) -
オブジェクトと other が等しければ真を返します。Hash で二つのキー が等しいかどうかを判定するのに使われます。
... Object#hash メソッ
ドも再定義しなければなりません。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
p("foo".eql?("bar")) #=> false
p("foo".eql?("foo")) #=> true
p(4.eql?(4)) #=> true
p(4.eql?(4.0)) #=> false
//}
@see Object#hash,Object#equal?,Object#==... -
Object
# equal?(other) -> bool (126.0) -
other が self 自身の時、真を返します。
...Object#object_idが一致する
かどうかを調べます。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
p("foo".equal?("bar")) #=> false
p("foo".equal?("foo")) #=> false
p(4.equal?(4)) #=> true
p(4.equal?(4.0)) #=> false
p(:foo.equal? :foo) #=> true
//}
@see Object......#object_id,Object#==,Object#eql?,Symbol... -
Object
# instance _ of?(klass) -> bool (126.0) -
オブジェクトがクラス klass の直接のインスタンスである時真を返します。
...常に obj.kind_of?(c) も成立します。
@param klass Classかそのサブクラスのインスタンスです。
//emlist[][ruby]{
class C < Object
end
class S < C
end
obj = S.new
p obj.instance_of?(S) # true
p obj.instance_of?(C) # false
//}
@see Object#kind_of?,Object#class... -
Object
# is _ a?(mod) -> bool (126.0) -
オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。
...も真を返します。
Module#includeだけではなく、Object#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 (126.0) -
オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。
...も真を返します。
Module#includeだけではなく、Object#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...