309件ヒット
[1-100件を表示]
(0.188秒)
キーワード
- === (12)
- =~ (9)
-
_ dump (12) - class (12)
- clone (12)
-
define
_ singleton _ method (24) - dup (12)
- freeze (12)
- hash (12)
- inspect (12)
- itself (12)
- method (12)
-
pretty
_ inspect (12) -
pretty
_ print _ inspect (12) -
pretty
_ print _ instance _ variables (12) -
psych
_ to _ yaml (12) -
public
_ method (12) -
singleton
_ class (12) -
singleton
_ method (12) - tainted? (6)
- then (14)
-
to
_ s (12) -
to
_ str (12) -
to
_ yaml (12) -
yield
_ self (16)
検索結果
先頭5件
-
Object
# inspect -> String (9215.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...ect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}
inspect メソッドをオーバーライドしなかった場合、クラス名とインスタンス
変数の名前、値の組を元にした文字列を返します。
//emlist[][ruby]{
cl......ass Foo
end
Foo.new.inspect # => "#<Foo:0x0300c868>"
class Bar
def initialize
@bar = 1
end
end
Bar.new.inspect # => "#<Bar:0x0300c868 @bar=1>"
//}
@see Kernel.#p... -
Object
# pretty _ print _ inspect -> String (9209.0) -
Object#pretty_print を使って Object#inspect と同様に オブジェクトを人間が読める形式に変換した文字列を返します。
...
Object#pretty_print を使って Object#inspect と同様に
オブジェクトを人間が読める形式に変換した文字列を返します。
出力する全てのオブジェクトに Object#pretty_print が定義されている必要があります。
そうでない場合には RuntimeEr......ror が発生します。
@raise RuntimeError 出力する全てのオブジェクトに Object#pretty_print が定義されて
いない場合に発生します。... -
Object
# pretty _ inspect -> String (9203.0) -
self を pp で表示したときの結果を文字列として返します。
self を pp で表示したときの結果を文字列として返します。 -
Object
# singleton _ class -> Class (6232.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...れ NilClass, TrueClass,
FalseClass を返します。
@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。
//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #=> #<Class:String>
nil.singleton_class......#=> NilClass
//}
@see Object#class... -
Object
# clone(freeze: nil) -> object (6216.0) -
オブジェクトの複製を作成して返します。
...ピーし、
clone はそれに加えて freeze, 特異メソッドなどの情報も含めた完全な複製を作成します。
clone や dup は浅い(shallow)コピーであることに注意してください。後述。
TrueClass, FalseClass, NilClass, Symbol, そして Numeric クラスの......いコピーを返します。
@raise ArgumentError TrueClass などの常に freeze されているオブジェクトの freeze されていないコピーを作成しようとしたときに発生します。
//emlist[][ruby]{
obj = "string"
obj.taint
def obj.fuga
end
obj.freeze
p(obj.equal?(obj......#=> true
p(obj.respond_to?(:fuga)) #=> true
obj_c = obj.clone
p(obj.equal?(obj_c)) #=> false
p(obj == obj_c) #=> true
p(obj_c.tainted?) #=> true
p(obj_c.frozen?) #=> true
p(obj_c.respond_to?(:fuga)) #=> true
obj_d = obj.dup
p(obj.equal?(obj......#=> true
p(obj.respond_to?(:fuga)) #=> true
obj_c = obj.clone
p(obj.equal?(obj_c)) #=> false
p(obj == obj_c) #=> true
p(obj_c.tainted?) #=> false
p(obj_c.frozen?) #=> true
p(obj_c.respond_to?(:fuga)) #=> true
obj_d = obj.dup
p(obj.equal?(obj......いコピーを返します。
@raise ArgumentError TrueClass などの常に freeze されているオブジェクトの freeze されていないコピーを作成しようとしたときに発生します。
//emlist[][ruby]{
obj = "string"
def obj.fuga
end
obj.freeze
p(obj.equal?(obj))......rue
p(obj.frozen?) #=> true
p(obj.respond_to?(:fuga)) #=> true
obj_c = obj.clone
p(obj.equal?(obj_c)) #=> false
p(obj == obj_c) #=> true
p(obj_c.frozen?) #=> true
p(obj_c.respond_to?(:fuga)) #=> true
obj_d = obj.dup
p(obj.equal?(obj_d)) #=> fal... -
Object
# class -> Class (6208.0) -
レシーバのクラスを返します。
...レシーバのクラスを返します。
//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}
@see Class#superclass,Object#kind_of?,Object#instance_of?... -
Object
# psych _ to _ yaml(options = {}) -> String (6204.0) -
オブジェクトを YAML document に変換します。
...YAML document に変換します。
options でオプションを指定できます。
Psych.dump と同じなので詳しくはそちらを参照してください。
syck に to_yaml メソッドがあるため、
psych_to_yaml が別名として定義されています。将来的に
syck が......廃止された場合 psych_to_yaml は廃止
される予定であるため、特別の事情がない限り to_yaml を用いてください。
@param options 出力オプション
@see Psych.dump... -
Object
# pretty _ print _ instance _ variables -> [String | Symbol] (6203.0) -
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。
pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。 -
Object
# public _ method(name) -> Method (6136.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...ブジェクトの public メソッド name をオブジェクト化した
Method オブジェクトを返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 priv......ate メソッド名を引数として与えると発生します。
//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...