るりまサーチ

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

別のキーワード

  1. kernel require
  2. getoptlong require_order
  3. rubygems/custom_require require
  4. irb/ext/use-loader irb_require
  5. require execute

モジュール

キーワード

検索結果

<< 1 2 3 > >>

Exception#backtrace_locations -> [Thread::Backtrace::Location] (9209.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require
"date"
def check_long_month(month)
return...
...if Date.new(2000, 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>'", "t...
...est.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}

@see Exception#backtrace...

Enumerable#none? -> bool (6109.0)

ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。

...ます。


//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set[].none? # => true
Set[nil].none?...
...# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}...
...します。

//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # => true
Set[].none?...
...# => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}...
...# => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}

@see Array#none?...

Enumerable#none? {|obj| ... } -> bool (6109.0)

ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。

...ます。


//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set[].none? # => true
Set[nil].none?...
...# => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}...
...します。

//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # => true
Set[].none?...
...# => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}...
...# => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}

@see Array#none?...

Enumerable#none?(pattern) -> bool (6109.0)

ブロックを指定しない場合は、 Enumerable オブジェクトのすべての 要素が偽であれば真を返します。そうでなければ偽を返します。

...します。

//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].none? {|word| word.length == 5} # => true
Set['ant', 'bear', 'cat'].none? {|word| word.length >= 4} # => false
Set['ant', 'bear', 'cat'].none?(/d/) # => true
Set[].none?...
...# => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}...
...# => true
Set[nil].none? # => true
Set[nil,false].none? # => true
Set[nil, false, true].none? # => false
//}

@see Array#none?...

Enumerable#one? -> bool (6109.0)

ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。

...]{
require
'set'
Set['ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one? # => true
Set[].one...
...す。

//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one?(/t/) # => false
Set[nil, true, 99].one?...
...# => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}...
...# => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}

@see Array#one?...

絞り込み条件を変える

Enumerable#one? {|obj| ... } -> bool (6109.0)

ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。

...]{
require
'set'
Set['ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set[nil, true, 99].one? # => false
Set[nil, true, false].one? # => true
Set[].one...
...す。

//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one?(/t/) # => false
Set[nil, true, 99].one?...
...# => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}...
...# => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}

@see Array#one?...

Enumerable#one?(pattern) -> bool (6109.0)

ブロックを指定しない場合は、 Enumerable オブジェクトの要素のうち ちょうど一つだけが真であれば、真を返します。 そうでなければ偽を返します。

...す。

//emlist[例][ruby]{
require
'set'
Set['ant', 'bear', 'cat'].one? {|word| word.length == 4} # => true
Set['ant', 'bear', 'cat'].one? {|word| word.length > 4} # => false
Set['ant', 'bear', 'cat'].one?(/t/) # => false
Set[nil, true, 99].one?...
...# => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}...
...# => false
Set[nil, true, false].one? # => true
Set[nil, true, 99].one?(Integer) # => true
Set[].one? # => false
//}

@see Array#one?...

Method#source_location -> [String, Integer] | nil (6109.0)

ソースコードのファイル名と行番号を配列で返します。

...@see Proc#source_location

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----

require
'/tmp/foo'

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]

method(:puts).source_location # => nil
//}...

UnboundMethod#source_location -> [String, Integer] | nil (6109.0)

ソースコードのファイル名と行番号を配列で返します。

...nil を返します。

//emlist[例][ruby]{
require
'time'

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_location...
<< 1 2 3 > >>