別のキーワード
ライブラリ
- rss (12)
モジュール
-
RSS
:: Maker (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
ruby 1
. 6 feature (12) - tsort (12)
検索結果
-
RSS
:: Maker . make(version , &block) (21202.0) -
@todo versionには"1.0"または"0.9"または "0.91"または"2.0"を指定します."0.9" と"0.91"は同じであることに注意してください.
...@todo
versionには"1.0"または"0.9"または
"0.91"または"2.0"を指定します."0.9"
と"0.91"は同じであることに注意してください.
blockを実行したあとのmakerオブジェクトから
RSSオブジェクトを生成して返します.... -
ruby 1
. 6 feature (66.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...[]
=> ruby 1.6.7 (2002-08-01) [i586-linux]
["bar"]
: 2002-06-13 Hash[]
Hash[] で、キーとなる文字列を dup & freeze していませんでした。
a = "key"
h = Hash[a,"val"]
h.keys[0].upcase!
p a
=> ruby 1.6.7 (2002......gexp.quote("#")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"#"
0
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-07-30) [i586-linux]
"\\#"......xp.quote("\t")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"\t"
0
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-05-04) [i586-linux]
"\\t"... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (54.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...ています。
def foo
yield 1,2,3,4
end
foo {|a,b,c| p [a,b,c]; break }
foo( &proc {|a,b,c| p [a,b,c]; break } )
foo( &Proc.new {|a,b,c| p [a,b,c]; break } )
=> ruby 1.6.8 (2002-12-24) [i586-linux]
[1, 2, 3]
[1, 2......i、String#oct もこの prefix を認識します。
: ((<メソッド引数の & 修飾|メソッド呼び出し/イテレータ>)) [compat]
: ((<Proc#to_proc|Proc/to_proc>)) [new]
メソッドに渡す引数に & を修飾した場合、渡すオブジェクトが to_proc を
持ってい......#
# class SubClass < Class
# end
#
# #=> -:1:in `inherited': can't make subclass of Class (TypeError)
# from -:1
# ruby 1.7.1 (2001-06-12) [i586-linux]
#
# #=> -:1: can't make subclass of Class (TypeError)
# ruby 1.7.1 (2001-07-31) [i586-linux]
==... -
tsort (36.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...ef 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_components
#=> [[4], [2, 3], [1]]
//}
=== より現実的な例
非常に単純な `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] = [triple]}
@dep[triple] = inputs
end......= nil ||
inputs_time != nil && outputs_time <= inputs_time
sleep 1 if inputs_time != nil && inputs_time.to_i == Time.now.to_i
block.call
end
end
}
end
def tsort_each_child(node, &block)
@dep[node].each(&block)
end
include TSort
end
def...