588件ヒット
[1-100件を表示]
(0.056秒)
別のキーワード
ライブラリ
- ビルトイン (528)
- rake (24)
-
rexml
/ document (24) -
rexml
/ streamlistener (12)
クラス
- Array (24)
- BasicObject (60)
- Class (28)
- Hash (19)
- Method (42)
- Module (156)
- Object (72)
- Proc (7)
-
REXML
:: CData (24) -
Thread
:: Backtrace :: Location (12) - UnboundMethod (12)
モジュール
- Enumerable (96)
-
REXML
:: StreamListener (12) -
Rake
:: TaskManager (24)
キーワード
- ! (12)
- != (12)
- << (14)
- <=> (12)
- == (12)
- === (12)
- ancestors (12)
-
base
_ label (12) - bind (12)
-
class
_ variables (12) -
const
_ source _ location (12) -
define
_ task (12) - entitydecl (12)
- include (12)
- include? (12)
- inherited (12)
- initialize (12)
- inspect (12)
-
instance
_ eval (24) -
instance
_ methods (12) -
instance
_ of? (12) - intern (12)
-
is
_ a? (12) -
kind
_ of? (12) - max (48)
-
method
_ defined? (12) - methods (12)
- min (48)
-
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
public
_ method _ defined? (12) - subclasses (4)
-
super
_ method (11) - superclass (12)
-
to
_ a (12) -
to
_ ary (12) -
to
_ h (19) -
to
_ s (24) -
undef
_ method (12) - value (12)
検索結果
先頭5件
-
Module
# <(other) -> bool | nil (18167.0) -
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
...//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo # => true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil
p Foo < Object.new # => in `<': compared with non class/module (TypeErr... -
Class
# subclasses -> [Class] (15256.0) -
自身が直接のスーパークラスになっている(特異クラスを除く)クラスの配列を返します。 返り値の配列の順序は未定義です。
...を除く)クラスの配列を返します。
返り値の配列の順序は未定義です。
//emlist[例][ruby]{
class A; end
class B < A; end
class C < B; end
class D < A; end
A.subclasses # => [D, B]
B.subclasses # => [C]
C.subclasses # => []
//}
@see Class#superclass... -
Class
# superclass -> Class | nil (15238.0) -
自身のスーパークラスを返します。
...][ruby]{
File.superclass #=> IO
IO.superclass #=> Object
class Foo; end
class Bar < Foo; end
Bar.superclass #=> Foo
Object.superclass #=> BasicObject
//}
ただし BasicObject.superclass は nil を返します。
//emlist[例][ruby]{
BasicObject.superclass #......=> nil
//}
@see Class#subclasses... -
Class
# inherited(subclass) -> () (9149.0) -
クラスのサブクラスが定義された時、新しく生成されたサブクラスを引数 にインタプリタから呼び出されます。このメソッドが呼ばれるタイミングは クラス定義文の実行直前です。
...@param subclass プログラム内で新たに定義された自身のサブクラスです。
//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......inherited by "Bar"
# executing class body
//}... -
Module
# class _ variables(inherit = true) -> [Symbol] (6144.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...ジュールのクラス変数を含みます。
//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variables # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}
@see Module.constants,... -
Method
# <<(callable) -> Proc (6131.0) -
self と引数を合成した Proc を返します。
...st[例][ruby]{
def f(x)
x * x
end
def g(x)
x + x
end
# (3 + 3) * (3 + 3)
p (method(:f) << method(:g)).call(3) # => 36
//}
//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)......Hello, World!
Hello, Ruby!
TEXT
pipeline = method(:pp) << WordScanner << File.method(:read)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>... -
Module
# <=>(other) -> Integer | nil (6131.0) -
self と other の継承関係を比較します。
...のクラスやモジュール
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar <=> Foo # => -1
p Baz <=> Bar # => -1
p Baz <=> Foo # => -1
p Baz <=> Qux # => nil
p Qux <=> Baz # => nil
p Baz <=> Object.new # => nil
//}... -
Proc
# <<(callable) -> Proc (6125.0) -
self と引数を合成した Proc を返します。
...//emlist[例][ruby]{
f = proc { |x| x * x }
g = proc { |x| x + x }
# (3 + 3) * (3 + 3)
p (f << g).call(3) # => 36
//}
//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello,......World!
Hello, Ruby!
TEXT
pipeline = proc { |data| puts "word count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => word count: 4
//}
@see Method#<<, Method#>>... -
Module
# ancestors -> [Class , Module] (126.0) -
クラス、モジュールのスーパークラスとインクルードしているモジュール を優先順位順に配列に格納して返します。
...るモジュール
を優先順位順に配列に格納して返します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
p ancestors
p included_modules
p superclass
end
# => [Baz, Bar, Foo, Object, Kernel, BasicObject]
# => [Foo, Kernel]
# => Bar
//}
@see... -
Rake
:: TaskManager # intern(task _ class , task _ name) -> Rake :: Task (126.0) -
タスクを検索します。
...am task_class タスクのクラスを指定します。
@param task_name タスクの名前を指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do |task|
task.application.intern(Rake::Task, "test_rake_app") # => <Rake::Ta......sk test_rake_app => []>
task.application.intern(Rake::Task, "sample_task") # => <Rake::Task sample_task => []>
end
//}...