るりまサーチ (Ruby 2.7.0)

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. ipaddr to_i
  5. matrix i

検索結果

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

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

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

@param severity ログレベル。

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

@param progname プログラム名

@param msg メッセージ。

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

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

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

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

TracePoint#callee_id -> Symbol | nil (36730.0)

イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。

イベントが発生したメソッドの呼ばれた名前を Symbol で返します。
トップレベルであった場合は nil を返します。

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

//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end

trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
e...

BasicObject#instance_eval(expr, filename = "(eval)", lineno = 1) -> object (18976.0)

オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。

オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを
評価してその結果を返します。

オブジェクトのコンテキストで評価するとは評価中の self をそのオブジェクトにして実行するということです。
また、文字列 expr やブロック中でメソッドを定義すればそのオブジェクトの特異メソッドが定義されます。

ただし、ローカル変数だけは、文字列 expr の評価では instance_eval の外側のスコープと、ブロックの評価ではそのブロックの外側のスコープと、共有します。

メソッド定義の中で instance_eval でメソッドを定義した場...

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

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

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

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

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

@see Module#public_instance_method, Object#method

//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello ";...

絞り込み条件を変える

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

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

オブジェクトの特異メソッド 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 = ...

TracePoint#method_id -> Symbol | nil (18430.0)

イベントが発生したメソッドの定義時の名前を Symbol で返します。 トップレベルであった場合は nil を返します。

イベントが発生したメソッドの定義時の名前を Symbol で返します。
トップレベルであった場合は nil を返します。

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

//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end

trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :alias_name]
e...

Module#ruby2_keywords(method_name, ...) -> nil (703.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword argument...

Logger#formatter -> String (358.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 =...