別のキーワード
ライブラリ
- ビルトイン (677)
- csv (48)
- rake (108)
-
rexml
/ document (24) -
rexml
/ streamlistener (12)
クラス
- Array (45)
- BasicObject (60)
- CSV (48)
- Class (12)
-
Enumerator
:: Lazy (48) -
Enumerator
:: Yielder (12) - Exception (24)
- Hash (19)
- Method (42)
- Module (144)
- Object (120)
-
REXML
:: Attributes (24) -
Rake
:: NameSpace (24) -
RubyVM
:: InstructionSequence (48) - String (12)
-
Thread
:: Backtrace :: Location (12) - TracePoint (7)
- UnboundMethod (12)
モジュール
- Enumerable (60)
-
REXML
:: StreamListener (12) -
Rake
:: TaskManager (84)
キーワード
- ! (12)
- != (12)
- << (19)
- <= (12)
- <=> (12)
- == (12)
- === (12)
- [] (24)
-
absolute
_ path (12) - ancestors (12)
-
backtrace
_ locations (12) -
base
_ label (24) - bind (12)
-
class
_ variables (12) - clear (12)
-
const
_ source _ location (12) - convert (36)
-
define
_ task (12) - each (12)
-
each
_ attribute (12) - entitydecl (12)
-
enum
_ for (48) - inherited (12)
- initialize (12)
- inspect (12)
-
instance
_ eval (24) -
instance
_ methods (12) -
instance
_ of? (12) -
instruction
_ sequence (7) - intern (12)
-
is
_ a? (12) -
kind
_ of? (12) - label (12)
- lazy (12)
- lookup (12)
- max (24)
-
method
_ defined? (12) - methods (12)
- min (24)
- pack (21)
- path (12)
-
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
public
_ method _ defined? (12) - puts (12)
-
set
_ backtrace (12) -
super
_ method (11) -
synthesize
_ file _ task (12) - tasks (24)
-
to
_ a (12) -
to
_ ary (12) -
to
_ enum (48) -
to
_ h (19) -
to
_ s (12) -
undef
_ method (12) - unpack (12)
検索結果
先頭5件
-
Module
# <(other) -> bool | nil (18267.0) -
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
...較演算子。self が other の子孫である場合、 true を返します。
self が other の先祖か同一のクラス/モジュールである場合、false を返します。
継承関係にないクラス同士の比較では
nil を返します。
@param other 比較対象のモジ......ラス
@raise TypeError other がクラスやモジュールではない場合に発生します。
//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 # => n......il
p Baz > Qux # => nil
p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}... -
Module
# protected _ method _ defined?(name , inherit=true) -> bool (12249.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が protected であるときに true を返します。 そうでなければ false を返します。
...ュールに定義されており、
しかもその可視性が protected であるときに true を返します。
そうでなければ false を返します。
@param name Symbol か String を指定します。
@param inherit 真を指定するとスーパークラスや include したモジ......ethod_defined?, Module#public_method_defined?, Module#private_method_defined?
//emlist[例][ruby]{
module A
def method1() end
end
class B
protected
def method2() end
end
class C < B
include A
def method3() end
end
A.method_defined? :method1 #=> true
C.protected_meth......od_defined? "method1" #=> false
C.protected_method_defined? "method2" #=> true
C.protected_method_defined? "method2", true #=> true
C.protected_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> true
//}... -
Rake
:: TaskManager # define _ task(task _ class , *args) { . . . } -> Rake :: Task (9331.0) -
タスクを定義します。
...aram task_class タスククラスを指定します。
@param args タスクに渡すパラメータを指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
Rake.application.define_task(Rake::Task, :t) # => <Rake::Task t =>......[]>
end
//}... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (9331.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...pt_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval("put......s 'hello'")
end
//}
@raise RuntimeError :script_compiled イベントのための
イベントフックの外側で実行した場合に発生します。... -
Method
# super _ method -> Method | nil (9237.0) -
self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。
...Method オブジェ
クトにして返します。
@see UnboundMethod#super_method
//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end
class Sub < Super
def foo
"subclass method"
end
end
m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subclass metho......d"
m.super_method # => #<Method: Super#foo>
m.super_method.call # => "superclass method"
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9231.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ption#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Dat......month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_ex......ception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (9225.0) -
各属性に対しブロックを呼び出します。
...ML::Attribute オブジェクトで渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").......first
a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}... -
Enumerator
:: Yielder # <<(object) -> () (9219.0) -
Enumerator.new で使うメソッドです。
...numerator.new で使うメソッドです。
生成された Enumerator オブジェクトの each メソッドを呼ぶと
Enumerator::Yielder オブジェクトが渡されたブロックが実行され、
ブロック内の << が呼ばれるたびに each に渡されたブロックが
<< に......渡された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y << 1
y << 2
y << 3
end
enum.each do |v|
p v
end
# => 1
# 2
# 3
//}... -
Method
# <<(callable) -> Proc (9149.0) -
self と引数を合成した Proc を返します。
...ます。
Method#>> とは呼び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
def f(x)
x * x
end
def g(x)
x + x
end
# (3 + 3) * (3 + 3)
p (method(:f) << method(:g)).call(3....../}
//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#>>... -
Rake
:: TaskManager # tasks -> Array (9131.0) -
全てのタスクリストを返します。
...st[][ruby]{
# Rakefile での記載例とする
require 'pp'
task default: :test_rake_app2
task :test_rake_app1 do |task|
end
task :test_rake_app2 do |task|
pp task.application.tasks
# => [<Rake::Task default => [test_rake_app2]>,
# <Rake::Task test_rake_app1 => []>,
# <Rake::Task t......est_rake_app2 => []>]
end
//}...