るりまサーチ

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

別のキーワード

  1. openssl t61string
  2. asn1 t61string
  3. t61string new
  4. matrix t
  5. fiddle type_size_t

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Logger::Formatter#call(severity, time, progname, msg) -> String (21303.0)

ログ情報をフォーマットして返します。

...ログ情報をフォーマットして返します。

@param severity ログレベル。

@param time 時間。Time クラスのオブジェクト。

@param progname プログラム名

@param msg メッセージ。...

Syslog::Logger::Formatter#call(severity, time, progname, message) -> String (21303.0)

引数を元にフォーマットした文字列を返します。

引数を元にフォーマットした文字列を返します。

ライブラリ内部で使用します。

Thread::Backtrace::Location#absolute_path -> String (9214.0)

self が表すフレームの絶対パスを返します。

...list[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end

# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}

@see Thread::Backtrace::Location...
...#path...

Logger#formatter -> String (6214.0)

ログを出力する際に使用するフォーマッターを取得します。

...持つ call メソッドは 4 つの引数 (severity, time, program name, message) を受けとります。

//emlist[例][ruby]{
require 'logger'

logger = Logger.new(STDOUT)
logger.formatter # => nil
logger.info("test")
# => I, [2019-05-09T22:13:56.509159 #13912] INFO -- : test

ltsv_formatter =...
...proc { |severity, timestamp, progname, msg|
"time:#{timestamp}\tlevel:#{severity}\tprogname:#{progname}\tmessage:#{msg}\n"
}
logger.formatter = ltsv_formatter
logger.formatter # => #<Proc:0x00007fa3048b8e00@/path/to/file:8>
logger.info("MyApp") { "test" }

# => time:2019-05-09 22:13:56 +0900 level...
...:INFO progname:MyApp message:test
//}...

Thread::Backtrace::Location#inspect -> String (6214.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...
T
hread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).loc...
...ations.map do |call|
puts call.inspect
end

# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"
//}...

絞り込み条件を変える

Thread::Backtrace::Location#to_s -> String (6214.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...el.#caller と同じ表現にした文字列を返し
ます。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.to_s
end

# => path/to/foo.rb:5:in `initiali...
...ze'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'
//}...

TracePoint#inspect -> String (6214.0)

self の状態を人間に読みやすい文字列にして返します。

...self の状態を人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
def foo(ret)
ret
end
t
race = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
t
race.enable
foo 1
//}...

Object#method(name) -> Method (6213.0)

オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。

...
Method オブジェクトを返します。

@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。

//emlist[][ruby]{
me = -365.method(:abs)
p me #=> #<Method: Integer#abs...
...>
p me.call #=> 365
//}

@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#singleton_method...

TracePoint#path -> String (6208.0)

イベントが発生したファイルのパスを返します。

...トが発生したファイルのパスを返します。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
t
race = TracePoint.new(:call) do |tp|
p tp.path # => "/path/to/test.rb"
end
t
race.enable
foo 1
//}...
<< 1 2 > >>