るりまサーチ

最速Rubyリファレンスマニュアル検索!
480件ヒット [1-100件を表示] (0.059秒)
トップページ > クエリ:ruby[x] > クラス:Object[x] > クエリ:class[x]

別のキーワード

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

検索結果

<< 1 2 3 ... > >>

Object#class -> Class (18269.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#singleton_class -> Class (6245.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#singleton_methods(inherited_too = true) -> [Symbol] (121.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...た特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。

singleton_methods(false) は、Object#methods(false) と同じで...
...1][ruby]{
Parent = Class.new

class
<<Parent
private; def private_class_parent() end
protected; def protected_class_parent() end
public; def public_class_parent() end
end

Foo = Class.new(Parent)

class
<<Foo
private; def private_class_foo() end
protected; def protected_class_foo()...
...end
public; def public_class_foo() end
end

module Bar
private; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end

obj = Foo.new
class
<<obj
include Bar
private; def private_self() end
protected; def protected_self() end
public...

Object::FALSE -> FalseClass (107.0)

非推奨です。代表的な偽の値。false と同じ。

...の値。false と同じ。

この定数は過去との互換性のために提供されています。擬似変数 false を使ってください。
Ruby
では false と nil が偽として扱われます。
偽でない値(false でも nil でもない値) は全て真とみなされます。...

Object::NIL -> NilClass (107.0)

非推奨です。 nil と同じ。

...奨です。 nil と同じ。

この定数は過去との互換性のために提供されています。擬似変数 nil を使ってください。

Ruby
では false と nil が偽として扱われます。
偽でない値(false でも nil でもない値) は全て真とみなされます。...

絞り込み条件を変える

Object::TRUE -> TrueClass (107.0)

非推奨です。代表的な真の値。true と同じ。

...の値。true と同じ。

この定数は過去との互換性のために提供されています。擬似変数 true を使ってください。

Ruby
では false と nil が偽として扱われます。
偽でない値(false でも nil でもない値) は全て真とみなされます。...

Object#respond_to?(name, include_all = false) -> bool (49.0)

オブジェクトがメソッド name を持つとき真を返します。

...
Ruby
の組み込みライブラリや標準ライブラリなど、C言語で実装されているメソッドのみです。
Ruby
で実装されたメソッドで NotImplementedError が発生する場合は true を返します。

メソッドが定義されていない場合は、Object#resp...
...ます。省略した場合
は false(含めない) を指定した事になります。

//emlist[][ruby]{
class
F
def hello
"Bonjour"
end
end

class
D
private
def hello
"Guten Tag"
end
end
list = [F.new,D.new]

list.each{|it| puts it.hello if it.respond_to?(:he...
...ate_method
raise NotImplementedError.new
end

def finish
puts "finish"
end
end

class
ImplTemplateMethod
include Template
def template_method
"implement template_method"
end
end

class
NotImplTemplateMethod
include Template

# not implement template_method
end

puts ImplT...

Object#===(other) -> bool (43.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...ルトでは内部で Object#== を呼び出します。

when 節の式をレシーバーとして === を呼び出すことに注意してください。

また Enumerable#grep でも使用されます。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
age = 12
# (0..2).=...
...when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"
end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's wo...
...rld>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...

Object#initialize(*args, &block) -> object (37.0)

ユーザ定義クラスのオブジェクト初期化メソッド。

...

このメソッドは Class#new から新しく生成されたオブ
ジェクトの初期化のために呼び出されます。他の言語のコンストラクタに相当します。
デフォルトの動作ではなにもしません。

initialize には
Class
#new に与えられた引数...
...@param block 初期化時のブロック引数です。必須ではありません。

//emlist[][ruby]{
class
Foo
def initialize name
puts "initialize Foo"
@name = name
end
end

class
Bar < Foo
def initialize name, pass
puts "initialize Bar"
super name
@pass = pass
end...
...end

it = Bar.new('myname','0500')
p it
#=> initialize Bar
# initialize Foo
# #<Bar:0x2b68f08 @name="myname", @pass="0500">
//}

@see Class#new...

Object.yaml_tag(tag) -> () (37.0)

クラスと tag の間を関連付けます。

... Ruby のオブジェクトに
変換したりその逆をしたりすることができます。

@param tag 対象のクラスに関連付けるタグの文字列

=== Example
require 'psych'

class
Foo
def initialize(x)
@x = x
end

attr_reader :x
end

# Dumps Ruby...
...w(3))
# =>
# --- !ruby/object:Foo
# x: 3

# Registers tag with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo class
Psych.dump(Foo.new(3), STDOUT)
# =>
# --- !<tag:example.com,2013:foo>
# x: 3

# Loads the object from the tagged YAML n...

絞り込み条件を変える

<< 1 2 3 ... > >>