るりまサーチ

最速Rubyリファレンスマニュアル検索!
869件ヒット [1-100件を表示] (0.149秒)

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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 での記載例とする

t
ask default: :test_rake_app
t
ask :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イベント発生時にコンパイルされた
Ruby
VM::InstructionSequenceインスタンスを返します。

//emlist[例][ruby]{
T
racePoint.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に似ていますが、
T
hread::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='&lt;'/>
<
/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!
T
EXT

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'

t
ask default: :test_rake_app2

t
ask :test_rake_app1 do |task|
end


t
ask :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

//}...

絞り込み条件を変える

<< 1 2 3 ... > >>