るりまサーチ

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

別のキーワード

  1. string []=
  2. string []
  3. string slice!
  4. string slice
  5. string gsub!

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

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

@
param severity ログレベル。

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

@
param progname プログラム名

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

Exception#full_message(highlight: true, order: :bottom) -> String (132.0)

例外の整形された文字列を返します。

...と order は 2.5.1 で追加されました。

@
param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@
param order :top か :bottom で指定する必...
...ack \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
$stderr = $stdout
p e.full_message # => "test.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:i...
...n `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}

@
see Exception.to_tty?...
...による文字装飾がついています。


@
param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。

@
param order :top か :bottom で指定する必...

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

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

...][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...

Thread::Backtrace::Location#base_label -> String (126.0)

self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。

...されます。

//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.base_label
end

# => initialize
# new
# <main>
//}

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

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

Thread::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).locations.map do |call|
puts call.inspect
end

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

絞り込み条件を変える

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

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

...フレームを Kernel.#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/f...

TracePoint#path -> String (114.0)

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

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

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

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

Object#singleton_method(name) -> Method (61.0)

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

...す。

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

//emlist[][ruby]{
class Demo
def initialize(n)
@
iv = n
end
def hello()
"Hello, @iv = #{@iv}"
end...
...end

k = Demo.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}

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

Module#instance_method(name) -> UnboundMethod (43.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...オブジェクト化した UnboundMethod を返します。

@
param name メソッド名を Symbol または String で指定します。

@
raise NameError self に存在しないメソッドを指定した場合に発生します。

@
see Module#public_instance_method, Object#method

//emlist[例]...
...d(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string
.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...
<< 1 2 > >>