るりまサーチ

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

別のキーワード

  1. shell cat
  2. cat new
  3. cat each
  4. filter cat
  5. shell/filter cat

ライブラリ

クラス

モジュール

検索結果

Warning.[](category) -> bool (18200.0)

...

cat
egory の種類の警告を表示するかどうかのフラグを返します。

@param category 警告の種類を指定します。

サポートされている category は以下の通りです。

: :deprecated
非推奨の警告。
例: nil ではない値を $, や $; に設定す...

Kernel.#caller_locations(range) -> [Thread::Backtrace::Location] | nil (6206.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@pa...
...ef test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(start, length)
end

caller_locations # => []
test3(1, nil)
# => ["/User...
...(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}

@see Thread::Backtrace::Location, Kernel.#caller...

Kernel.#caller_locations(start = 1, length = nil) -> [Thread::Backtrace::Location] | nil (6206.0)

現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。

...現在のフレームを Thread::Backtrace::Location の配列で返します。引
数で指定した値が範囲外の場合は nil を返します。

@param start 開始フレームの位置を数値で指定します。

@param length 取得するフレームの個数を指定します。

@pa...
...ef test1(start, length)
locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end

def test2(start, length)
test1(start, length)
end

def test3(start, length)
test2(start, length)
end

caller_locations # => []
test3(1, nil)
# => ["/User...
...(1, 2)
# => ["/Users/user/test.rb:9:in `test2'", "/Users/user/test.rb:13:in `test3'"]
# => [9, 13]
# => ["/Users/user/test.rb", "/Users/user/test.rb"]
test3(2, 1)
# => ["/Users/user/test.rb:13:in `test3'"]
# => [13]
# => ["/Users/user/test.rb"]
//}

@see Thread::Backtrace::Location, Kernel.#caller...

Warning.[]=(category, flag) -> flag (6200.0)

category の警告を表示するかどうかのフラグを設定します。 サポートされている category については Warning.[] を参照してください。

...
cat
egory の警告を表示するかどうかのフラグを設定します。
サポートされている category については Warning.[] を参照してください。

@param category 警告の種類を指定します。
@param flag 真、または偽を指定します。

@see Warning.[]...

Module#const_source_location(name, inherited = true) -> [String, Integer] (6106.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

..._location('C4') # => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]

p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない

p A.const_source_locatio...
...p Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -- クラスが再定義された場合は最初の定義位置を返す

p B.const_source_location('A') # =...
...source_location('A') # => ["test.rb", 1] -- Object は継承していないが追加で modules をチェックする

p Object.const_source_location('A::C1') # => ["test.rb", 2] -- ネストの指定もサポートしている
p Object.const_source_location('String') # => [] -- 定...

絞り込み条件を変える

ruby 1.6 feature (102.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...範囲外の文字列を指定したときに例外を返す場合がありましたが、常に nil
を返すようになりました。(String#[]やString#slice と同じ結果を返すと
いうことです)

p "foo".slice!("bar") # <- 以前からこちらは nil を返してい...
...ymlink("foo", "bar")
p Dir.glob("bar")
=> ruby 1.6.7 (2002-03-01) [i586-linux]
[]

=> ruby 1.6.7 (2002-08-01) [i586-linux]
["bar"]

: 2002-06-13 Hash[]

Hash[] で、キーとなる文字列を dup & freeze していませんでした。

a = "k...
....6 の stable-snapshot を使用している方は、2002/1/30
の以下の変更(ChangeLog)

* re.c (rb_reg_search): should set regs.allocated.

で、メモリリークが起こるようになってることに注意してください。
2002/2/13 以降の修正版で直ってま...

ruby 1.8.3 feature (30.0)

ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))

...おいて定義されたメソッドを呼び出すことは、$SAFE レベル が 0 のとき
禁止されるようになりました。

$ cat mthd_taint.rb
th = Thread.new{
$SAFE = 3
class Hoge
def foo
puts "safe level: #{$SAFE}"
end
end
}...
....rb:11:in `foo': calling insecure method: foo (SecurityError)
from mthd_taint.rb:11

=== 2005-09-09
: String#* [ruby] [compat]
: String#[] [ruby] [compat]
空文字にも taint が伝播するようになりました。((<ruby-dev:26900>)) ((<ruby-dev:27121>))
$ ruby-1.8.2 -e 'p (...
...を呼んでしまうと空になるバグを修正しました。

$ ruby-1.8.2 -e '
d = Dir.new("/")
d.entries
p d.entries
'
[]


$ ruby-1.8.3 -e '
d = Dir.new("/")
d.entries
p d.entries
'
[".", "..", "dev", "home", "proc", "var", "tmp", "etc", "...

tsort (18.0)

tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。

...=== Example

//emlist[][ruby]{
require 'tsort'

class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end

{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
#=> [3, 2, 1, 4]

{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_c...
...単純な `make' に似たツールは以下のように実装できます。

//emlist[][ruby]{
require 'tsort'

class Make
def initialize
@dep = {}
@dep.default = []
end

def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [tripl...
...t1' }
m.rule(%w[t2]) { command 'date > t2' }
m.rule(%w[t3]) { command 'date > t3' }
m.rule(%w[t4], %w[t1 t3]) { command 'cat t1 t3 > t4' }
m.rule(%w[t5], %w[t4 t2]) { command 'cat t4 t2 > t5' }
m.build('t5')
//}

=== Bugs

tsort という名前は正確ではありません。なぜなら
このラ...