625件ヒット
[1-100件を表示]
(0.025秒)
キーワード
- bigdecimal (12)
-
cgi
/ session (12) - debug (12)
-
drb
/ extservm (12) -
drb
/ ssl (12) - fiddle (12)
- fileutils (12)
- find (12)
- irb (12)
-
irb
/ magic-file (12) - logger (12)
-
net
/ pop (12) -
net
/ smtp (12) - optparse (12)
- profile (6)
- profiler (6)
- rake (12)
-
rake
/ loaders / makefile (12) - rdoc (12)
-
rdoc
/ parser (12) -
rdoc
/ parser / c (12) - rss (12)
-
rubygems
/ command _ manager (12) -
rubygems
/ commands / build _ command (12) -
rubygems
/ commands / cert _ command (12) -
rubygems
/ commands / check _ command (12) -
rubygems
/ commands / cleanup _ command (12) -
rubygems
/ commands / contents _ command (12) -
rubygems
/ commands / dependency _ command (12) -
rubygems
/ commands / environment _ command (12) -
rubygems
/ commands / fetch _ command (12) -
rubygems
/ commands / generate _ index _ command (12) -
rubygems
/ commands / help _ command (12) -
rubygems
/ commands / install _ command (12) -
rubygems
/ commands / list _ command (12) -
rubygems
/ commands / lock _ command (12) -
rubygems
/ commands / mirror _ command (12) -
rubygems
/ commands / outdated _ command (12) -
rubygems
/ commands / pristine _ command (12) -
rubygems
/ commands / query _ command (12) -
rubygems
/ commands / rdoc _ command (12) -
rubygems
/ commands / search _ command (12) -
rubygems
/ commands / server _ command (12) -
rubygems
/ commands / sources _ command (12) -
rubygems
/ commands / specification _ command (12) -
rubygems
/ commands / uninstall _ command (12) -
rubygems
/ commands / unpack _ command (12) -
rubygems
/ config _ file (12) - tempfile (12)
-
test
/ unit (1) - tracer (12)
- tsort (12)
- un (12)
-
webrick
/ httpservlet / filehandler (12)
検索結果
-
fileutils (26001.0)
-
再帰的な削除などの基本的なファイル操作を行うためのライブラリです。
再帰的な削除などの基本的なファイル操作を行うためのライブラリです。 -
irb
/ magic-file (6001.0) -
irb が扱う入力やファイル中のマジックコメントを正しく扱うためのサブライ ブラリです。
irb が扱う入力やファイル中のマジックコメントを正しく扱うためのサブライ
ブラリです。
ユーザが直接使用するものではありません。 -
profile (6001.0)
-
Ruby プログラムのためのプロファイラです。 プロファイラとは効率改善のための調査に用いられるツールのことです。 profile ライブラリは各メソッドの実行時間に関する統計を出力します。
...profile ライブラリは各メソッドの実行時間に関する統計を出力します。
profile はそれ自身がオーバーヘッドになる
ためメソッド呼び出しあたりの処理時間がかなり遅くなります。
=== 使い方
以下のように、ruby に -r profile......オプションを付けて実行します。
$ ruby -r profile foo.rb
foo.rb の実行が終わると標準エラー出力にプロファイルが出力されます。
プロファイルは各メソッドの実行時間に関する統計からなりますが、
この時間には大きく分......味時間と呼ぶことにします。
=== 出力の意味
プロファイルの結果は例えば次のようになります。
$ ruby -r profile sample/sieve.rb 1000
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 … 略 …
% cumulative self self total... -
profiler (6001.0)
-
プロファイラの実装です。 現在、profile ライブラリは profiler ライブラリを 利用して実装されています。
...プロファイラの実装です。
現在、profile ライブラリは profiler ライブラリを
利用して実装されています。... -
rake
/ loaders / makefile (6001.0) -
Makefile をロードするためのライブラリです。
...Makefile をロードするためのライブラリです。... -
rubygems
/ config _ file (6001.0) -
設定ファイルに書かれている gem コマンドのオプションを オブジェクトに保存するためのライブラリです。
設定ファイルに書かれている gem コマンドのオプションを
オブジェクトに保存するためのライブラリです。 -
tempfile (6001.0)
-
テンポラリファイルを操作するためのクラスです
...テンポラリファイルを操作するためのクラスです
=== 参考
標準添付ライブラリ紹介 【第 15 回】 tmpdir, tempfile https://magazine.rubyist.net/articles/0029/0029-BundledLibraries.html... -
webrick
/ httpservlet / filehandler (6001.0) -
通常のファイルサーバとしての機能を提供するためのサーブレットを提供するライブラリです。
通常のファイルサーバとしての機能を提供するためのサーブレットを提供するライブラリです。 -
logger (97.0)
-
ログを記録するためのライブラリです。
...er.level = Logger::WARN
logger.debug("Created logger")
logger.info("Program started")
logger.warn("Nothing to do!")
path = "a_non_existent_file"
begin
File.foreach(path) do |line|
unless line =~ /^(\w+) = (.*)$/
logger.error("Line in wrong format: #{line.chomp}")
end
end
rescue......-07T02:22:53.649172 #11601] FATAL -- : Caught exception; exiting
F, [2017-12-07T02:22:53.649222 #11601] FATAL -- : No such file or directory @ rb_sysopen - a_non_existent_file (Errno::ENOENT)
logger_sample.rb:12:in `foreach'
logger_sample.rb:12:in `<main>'
これは log.level が Logger::WARN......'logfile.log')
//}
3. File オブジェクトを指定
//emlist[][ruby]{
require 'logger'
file = File.open('foo.log', File::WRONLY | File::APPEND)
# (古いファイルを削除する)新しいログファイルを作成する場合、以下のよ
# うに File::CREAT を指定。
# file = File.op... -
bigdecimal (49.0)
-
bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。
...ァイル file の合計数値を求める例です。
//emlist[digits.txt][ruby]{
0.1
0.1
0.1
//}
//emlist[][ruby]{
require "bigdecimal"
File::open("digits.txt", "r") do |file|
s = BigDecimal("0")
while line = file.gets
s = s + BigDecimal(line)
end
puts s # => 0.3e0
end
File::open("......digits.txt", "r") do |file|
s = 0
while line = file.gets
s = s + line.to_f
end
puts s # => 0.30000000000000004
end
//}
2 進数で計算すると誤差が入る可能性があります。
例えば 0.1 を2進で表現すると
0.1 = b1*2**(-1)+b1*2**(-2)+b3*2**(-3)+b4*2**(-4) ……......(u.nonzero? && u.exponent >= exp )
t = t.div(m57121,sig)
u = t.div(k,sig)
pi = pi + u
k = k + two
end
pi
end
if $0 == __FILE__
if ARGV.size == 1
puts "PI("+ARGV[0]+"):"
puts big_pi(ARGV[0].to_i)
else
puts "TRY: ruby pi.rb 1000"
end
end
//}
=== その他...