種類
- インスタンスメソッド (209)
- モジュール関数 (88)
- 文書 (22)
- ライブラリ (11)
- クラス (11)
モジュール
- Benchmark (22)
- Enumerable (66)
- FileUtils (11)
- Math (33)
- Syslog (11)
-
Syslog
:: Macros (11)
検索結果
先頭5件
-
ruby 1
. 9 feature (1914.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...w]: 追加されたクラス/メソッドなど
* [compat]: 変更されたクラス/メソッドなど(互換性のある変更) (only backward-compatibility) (影響の範囲が小さいと思われる変更もこちら)
* [change]: 変更されたクラス/メソッドなど(互換性......= 1.9.0
=== 2006-09-16
: Struct#inspect
=== 2006-09-14
: digest.rb
: Digest::Base.file
=== 2006-09-13
: Hash#compare_by_identity
: Hash#compare_by_identity?
: Hash#identical
: Hash#identical?
=== 2006-09-12
: Hash#compare_by_identity
: Hash#compare_by_identity?
=== 2006-09-11
: Hash#identi......== 2006-03-21
: MatchData#[] [compat]
名前による参照
((<ruby-dev:28446>))
=== 2006-03-03
: FileUtils.cp_r [lib] [compat]
remove_destination オプションの追加
((<ruby-dev:28417>))
=== 2006-02-15
: instance_eval
((<ruby-core:7365>))
=== 2006-02-03
: Integer#upto [com... -
Numeric (1470.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんど......を定義した時に、
演算メソッド(+, -, *, /, %, <=>, coerce)だけを定義すれば、数値クラスのそのほかのメソッドが
適切に定義されることを意図して提供されています。
+@, -@ は単項演算子 +, - を表しメソッド定義などではこの記......o - -
to_r | - o o o o
to_s | - o o o o
truncate | o o o o -
upto | -... -
Math
. # cbrt(x) -> Float (220.0) -
x の立方根(cubic root)を返します。
...uby]{
-9.upto(9) {|x|
p [x, Math.cbrt(x), Math.cbrt(x)**3]
}
# => [-9, -2.0800838230519, -9.0]
# [-8, -2.0, -8.0]
# [-7, -1.91293118277239, -7.0]
# [-6, -1.81712059283214, -6.0]
# [-5, -1.7099759466767, -5.0]
# [-4, -1.5874010519682, -4.0]
# [-3, -1.44224957030741, -3.0]
# [-2, -1.25......992104989487, -2.0]
# [-1, -1.0, -1.0]
# [0, 0.0, 0.0]
# [1, 1.0, 1.0]
# [2, 1.25992104989487, 2.0]
# [3, 1.44224957030741, 3.0]
# [4, 1.5874010519682, 4.0]
# [5, 1.7099759466767, 5.0]
# [6, 1.81712059283214, 6.0]
# [7, 1.91293118277239, 7.0]
# [8, 2.0, 8.0]
# [9, 2.08008382305... -
rake (186.0)
-
Rake というコマンドラインツールを扱うライブラリです。
...い方
$ rake --help
rake [-f rakefile] {options} targets...
Options are ...
-C, --classic-namespace トップレベルに Task, FileTask を定義します。
過去との互換性のためのオプションです。
-D, --describe [PATTE......パターンは省略可能です。
-n, --dry-run アクションを実行せずにタスクを実行します。
-e, --execute CODE Ruby のコードを実行して終了します。
-p, --execute-print CODE Ruby のコードを実行し......単な例:
# coding: utf-8
task :hello do
puts 'do task hello!'
end
動的にタスクを定義する例:
# coding: utf-8
require 'rake/testtask'
require 'rake/clean' # clean, clobber の二つのタスクを定義
task :default => [:test]
1.upto(8) do |n|
Rake::TestTa... -
Benchmark
. # bm(label _ width = 0 , *labels) {|rep| . . . } -> [Benchmark :: Tms] (142.0) -
Benchmark.#benchmark メソッドの引数を簡略化したものです。
...ire 'benchmark'
n = 50000
Benchmark.bm do |x|
x.report { for i in 1..n; a = "1"; end }
x.report { n.times do ; a = "1"; end }
x.report { 1.upto(n) do ; a = "1"; end }
end
#=>
#
# user system total real
# 1.033333 0.016667 1.016667 ( 0.492106)
# 1.483333 0.000000......times do ; a = "1"; end }
x.report("upto:") { 1.upto(n) do ; a = "1"; end }
end
#=>
# user system total real
# for: 1.050000 0.000000 1.050000 ( 0.503462)
# times: 1.533333 0.016667 1.550000 ( 0.735473)
# upto: 1.500000 0.016667 1.516667 ( 0......}
tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
[tf + tt + tu, (tf + tt + tu) / 3]
end
#=>
# user system total real
# for: 0.001467 0.004727 0.006194 ( 0.006193)
# times: 0.003814 0.000000 0.003814 ( 0.003814)
# upto: 0.003855 0.0... -
Date
# downto(min) -> Enumerator (122.0) -
このメソッドは、step(min, -1){|date| ...} と等価です。
...このメソッドは、step(min, -1){|date| ...} と等価です。
@param min 日付オブジェクト
@see Date#step, Date#upto... -
Date
# downto(min) {|date| . . . } -> self (122.0) -
このメソッドは、step(min, -1){|date| ...} と等価です。
...このメソッドは、step(min, -1){|date| ...} と等価です。
@param min 日付オブジェクト
@see Date#step, Date#upto... -
Benchmark
. # benchmark(caption = "" , label _ width = nil , fmtstr = nil , *labels) {|rep| . . . } -> [Benchmark :: Tms] (118.0) -
Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。
...; end }
tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
[tf+tt+tu, (tf+tt+tu)/3]
end
#=>
#
# user system total real
# for: 1.016667 0.016667 1.033333 ( 0.485749)
# times: 1.450000 0.016667 1.466667 ( 0.681367)
# upto: 1.533333 0.000000... -
Enumerable
# max _ by -> Enumerator (112.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i if h[x] }
#=> *
#... -
Enumerable
# max _ by {|item| . . . } -> object | nil (112.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i if h[x] }
#=> *
#... -
Enumerable
# max _ by(n) -> Enumerator (112.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x/5.0)**2) # normal distribution
}
# a is 20000 samples from e.
p a.length #=> 20000
h = a.group_by {|x| x }
-10.upto(10) {|x| puts "*" * (h[x].length/30.0).to_i if h[x] }
#=> *
#...