1058件ヒット
[1-100件を表示]
(0.038秒)
ライブラリ
クラス
- Array (96)
- BasicObject (60)
- Class (12)
- Date (12)
-
Enumerator
:: Lazy (48) -
Enumerator
:: Yielder (12) - IO (12)
- Method (24)
- Module (96)
- Object (132)
-
Psych
:: Visitors :: YAMLTree (24) -
REXML
:: Parent (36) - Range (128)
モジュール
- Enumerable (120)
- Kernel (24)
- Timeout (21)
キーワード
- ! (12)
- != (12)
-
$ < (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - << (48)
- <= (12)
- <=> (36)
- == (12)
- === (12)
- BasicObject (12)
- CSV (12)
- DelegateClass (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 7 . 0 (6) -
Profiler
_ _ (6) - Ruby プログラムの実行 (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- add (12)
- ancestors (12)
- bsearch (48)
-
class
_ variables (12) -
const
_ source _ location (12) - debug (12)
-
enum
_ for (48) - include (12)
- initialize (12)
- inspect (12)
-
instance
_ eval (24) -
instance
_ methods (12) -
instance
_ of? (12) -
is
_ a? (12) -
kind
_ of? (12) - max (130)
- methods (12)
- min (130)
- minmax (12)
-
net
/ smtp (12) - push (24)
- rdoc (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 4 feature (12) - sort (24)
- superclass (12)
- timeout (21)
-
to
_ enum (48) -
to
_ s (12) - クラス/メソッドの定義 (12)
- メソッド呼び出し(super・ブロック付き・yield) (12)
- 変数と定数 (12)
検索結果
先頭5件
-
Object
# <=>(other) -> 0 | nil (27118.0) -
self === other である場合に 0 を返します。そうでない場合には nil を返します。
...self === other である場合に 0 を返します。そうでない場合には nil を返します。
//emlist[例][ruby]{
a = Object.new
b = Object.new
a <=> a # => 0
a <=> b # => nil
//}
@see Object#===... -
Object
# initialize(*args , &block) -> object (21107.0) -
ユーザ定義クラスのオブジェクト初期化メソッド。
...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 Clas... -
Object
# methods(include _ inherited = true) -> [Symbol] (21054.0) -
そのオブジェクトに対して呼び出せるメソッド名の一覧を返します。 このメソッドは public メソッドおよび protected メソッドの名前を返します。
...ected メソッドの名前を返します。
ただし特別に、引数が偽の時は Object#singleton_methods(false) と同じになっています。
@param include_inherited 引数が偽の時は Object#singleton_methods(false) と同じになります。
//emlist[例1][ruby]{
class Parent......rotected_parent() end
public; def public_parent() end
end
class Foo < Parent
private; def private_foo() end
protected; def protected_foo() end
public; def public_foo() end
end
obj = Foo.new
class <<obj
private; def private_singleton() end
protected; def protecte......指定して
# いるが、Object のインスタンスメソッドは一覧から排除している。
p obj.methods(true) - Object.instance_methods(true)
p obj.public_methods(true) - Object.public_instance_methods(true)
p obj.private_methods(true) - Object.private_instance_methods(t... -
Object
# is _ a?(mod) -> bool (21042.0) -
オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。
...ードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prependに
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に fa......です。
//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 (21042.0) -
オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。
...ードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prependに
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に fa......です。
//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
# instance _ of?(klass) -> bool (21030.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
# ===(other) -> bool (21018.0) -
case 式で使用されるメソッドです。d:spec/control#case も参照してください。
...ドは case 式での振る舞いを考慮して、
各クラスの性質に合わせて再定義すべきです。
デフォルトでは内部で Object#== を呼び出します。
when 節の式をレシーバーとして === を呼び出すことに注意してください。
また Enumerable......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 world>
//}
@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep... -
Object
# enum _ for(method = :each , *args) -> Enumerator (21006.0) -
Enumerator.new(self, method, *args) を返します。
...s an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは......each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}
@see Enumerator, Enumerator#size... -
Object
# enum _ for(method = :each , *args) {|*args| . . . } -> Enumerator (21006.0) -
Enumerator.new(self, method, *args) を返します。
...s an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは......each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}
@see Enumerator, Enumerator#size...