ライブラリ
- ビルトイン (55)
- fileutils (17)
- logger (8)
-
rubygems
/ commands / which _ command (11) - syslog (22)
-
webrick
/ log (11)
クラス
- Logger (8)
-
RubyVM
:: InstructionSequence (11) -
WEBrick
:: BasicLog (11)
キーワード
-
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - WhichCommand (11)
- caller (33)
-
compile
_ option= (11) -
cp
_ lr (6) -
cp
_ r (11) - irb (11)
- logger (11)
- mask (11)
- mask= (11)
- new (19)
- rdoc (11)
-
rubygems
/ commands / build _ command (11) -
rubygems
/ commands / cert _ command (11) -
rubygems
/ commands / check _ command (11) -
rubygems
/ commands / cleanup _ command (11) -
rubygems
/ commands / contents _ command (11) -
rubygems
/ commands / dependency _ command (11) -
rubygems
/ commands / environment _ command (11) -
rubygems
/ commands / fetch _ command (11) -
rubygems
/ commands / generate _ index _ command (11) -
rubygems
/ commands / help _ command (11) -
rubygems
/ commands / install _ command (11) -
rubygems
/ commands / list _ command (11) -
rubygems
/ commands / lock _ command (11) -
rubygems
/ commands / mirror _ command (11) -
rubygems
/ commands / outdated _ command (11) -
rubygems
/ commands / pristine _ command (11) -
rubygems
/ commands / query _ command (11) -
rubygems
/ commands / rdoc _ command (11) -
rubygems
/ commands / search _ command (11) -
rubygems
/ commands / server _ command (11) -
rubygems
/ commands / sources _ command (11) -
rubygems
/ commands / specification _ command (11) -
rubygems
/ commands / uninstall _ command (11) -
rubygems
/ commands / unpack _ command (11) -
set
_ trace _ func (11) - 制御構造 (11)
検索結果
先頭5件
- debug
- FileUtils
. # cp _ lr(src , dest , noop: nil , verbose: nil , dereference _ root: true , remove _ destination: false) - FileUtils
. # cp _ r(src , dest , options = {}) -> () - Logger
. new(logdev , shift _ age = 0 , shift _ size = 1048576 , level: Logger :: Severity :: DEBUG , progname: nil , formatter: Formatter . new , datetime _ format: nil , shift _ period _ suffix: & # 39;%Y%m%d& # 39;) -> Logger - logger
-
debug (38006.0)
-
Ruby デバッガです。Ruby スクリプトのソースコードデバッグに使用します。
...したインタフェース rubydb3x.el が
https://github.com/ruby/elisp にあるので、活用してください。
=== 使い方
$ ruby -rdebug foo.rb
または、Emacs から
M-x load-library rubydb3x.el
M-x rubydb
=== デバッグコマンド
以下は、デバッガで使用......があります。
ここに挙げたもの以外を入力した場合、その入力を ruby の式として評価します。
: break
: break [<file>:]<position>|<class>:<method>
ブレークポイントを設定します。引数を省略した場合設定したブレークポ
イント... -
FileUtils
. # cp _ lr(src , dest , noop: nil , verbose: nil , dereference _ root: true , remove _ destination: false) (3006.0) -
src へのハードリンク dest を作成します。 src がディレクトリの場合、再帰的にリンクします。 dest がディレクトリの場合、src へのハードリンク dest/src を作成します。
...ルかディレクトリです。
@param options :noop, :verbose, :dereference_root, :remove_destination が指定できます。
c:FileUtils#options
@raise ArgumentError dest が src に含まれる場合に発生します。
@raise Errno::EEXIST src が一つで dest がすでに......quire 'fileutils'
FileUtils.rm_r site_ruby + '/mylib', force: true
FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
//}
//emlist[様々なファイルを対象ディレクトリにリンクする例][ruby]{
require 'fileutils'
FileUtils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
FileUtils.......クする例][ruby]{
require 'fileutils'
# ディレクトリそのものではなく、ディレクトリの内容をリンクしたい場合は、
# 以下のようになります。(たとえば src/x -> dest/x, src/y -> dest/y)
FileUtils.cp_lr 'src/.', 'dest'
# FileUtils.cp_lr('src', 'dest') は... -
FileUtils
. # cp _ r(src , dest , options = {}) -> () (3006.0) -
src を dest にコピーします。src がディレクトリであったら再帰的に コピーします。その際 dest がディレクトリなら dest/src にコピーします。
...c:FileUtils#options
//emlist[][ruby]{
# installing ruby library "mylib" under the site_ruby
require 'fileutils'
FileUtils.rm_r(site_ruby + '/mylib', force: true)
FileUtils.cp_r('lib/', site_ruby + '/mylib')
# other sample
require 'fileutils'
FileUtils.cp_r(%w(mail.rb field.rb debug/), site_......ruby + '/tmail')
FileUtils.cp_r(Dir.glob('*.rb'), '/home/taro/lib/ruby',
noop: true, verbose: true)
//}... -
Logger
. new(logdev , shift _ age = 0 , shift _ size = 1048576 , level: Logger :: Severity :: DEBUG , progname: nil , formatter: Formatter . new , datetime _ format: nil , shift _ period _ suffix: & # 39;%Y%m%d& # 39;) -> Logger (167.0) -
Logger オブジェクトを生成します。
...替えます。
@param level ログに記録する時のログレベルを指定します。省略した場合は
Logger::Severity::DEBUG です。
@param progname ログに記録する時のプログラム名を指定します。省略した場合は nil です。
@param formatter......er.new('logfile.log')
file = File.open('foo.log', File::WRONLY | File::APPEND | File::CREAT)
logger = Logger.new(file, 'daily')
logger = Logger.new(file, level: :info)
logger = Logger.new(file, progname: 'progname')
logger = Logger.new(file, formatter: formatter)
logger = Logger.new(file, datetime_... -
logger (150.0)
-
ログを記録するためのライブラリです。
...ムをクラッシュさせるような制御不可能なエラー
: ERROR
制御可能なエラー
: WARN
警告
: INFO
一般的な情報
: DEBUG
低レベルの情報
全てのメッセージは必ずログレベルを持ちます。また Logger オブジェクトも同じように
ロ...... DEBUG に下げるなどという使い方をします。
==== 例
//emlist[][ruby]{
require 'logger'
logger = Logger.new(STDOUT)
logger.level = Logger::WARN
logger.debug("Created logger")
logger.info("Program started")
logger.warn("Nothing to do!")
path = "a_non_existent_file"
begin
File.fo......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 になっているためです。WARN、
ERROR、FATALログのみが記録の対象になります。DEBUG、INFO... -
WEBrick
:: BasicLog . new(log _ file = nil , level = WEBrick :: BasicLog :: INFO) -> WEBrick :: BasicLog (119.0) -
WEBrick::BasicLog オブジェクトを生成して返します。
...WEBrick::BasicLog オブジェクトを生成して返します。
@param log_file ログを記録する先のオブジェクトを指定します。メソッド << が定義されている必要があります。
通常は String オブジェクトか IO オブジェクトです......録します。
ログレベルは重要度の順に FATAL, ERROR, WARN, INFO, DEBUG の5段階があります。
FATAL の重要度が一番高く DEBUG が一番低いです。
require 'webrick'
logger = WEBrick::BasicLog.new('testfile', WEBrick::BasicLog::FATAL)... -
NEWS for Ruby 2
. 3 . 0 (72.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...g-literal というコマンドラインオプションも導入されました
8976
* コマンドラインオプションに --debug または --debug=frozen-string-literal を付けて実行すると、
freeze された文字列を操作しようとして RuntimeError が発生し......_while
10769
* Enumerator::Lazy
* Enumerator::Lazy#grep_v を追加
11773
* File
* File.mkfifo
11536
* O_TMPFILE に対応する File::TMPFILE(File::Constants::TMPFILE) を追加
* Hash
* Hash#fetch_values を追加
10017
* Hash#dig を追加......643
* Hash#<=, Hash#<, Hash#>=, Hash#> を追加
10984
* Hash#to_proc を追加
11653
* IO
* 新しいフラグ File::SHARE_DELETE(File::Constants::SHARE_DELETE) が使用できます。
Windows で開いているファイルを削除することを許可しますが... -
Kernel
. # caller(range) -> [String] | nil (60.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真......の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start = 1) -> [String] | nil (60.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真......の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start , length) -> [String] | nil (60.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end
def foo
p parse_caller(caller.first)
end
def bar
foo
p parse_caller(caller.first)
end
bar
p parse_caller(caller.first)
#=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真......の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}...