るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

String#tr(pattern, replace) -> String (32351.0)

pattern 文字列に含まれる文字を検索し、 それを replace 文字列の対応する文字に置き換えます。

...pattern 文字列に含まれる文字を検索し、
それを replace 文字列の対応する文字に置き換えます。

pattern の形式は tr(1) と同じです。つまり、
`a-c' は a から c を意味し、"^0-9" のように
文字列の先頭が `^' の場合は指定文字以外...
...える文字

//emlist[例][ruby]{
p "foo".tr("f", "X") # => "Xoo"
p "foo".tr('a-z', 'A-Z') # => "FOO"
p "FOO".tr('A-Z', 'a-z') # => "foo"

# シーザー暗号の復号
p "ORYV".tr("A-Z", "D-ZA-C") # => "RUBY"

# 全角英数字といくつかの記号の半角化
email = "ruby−l...
...ang@example.com"
p email.tr("0-9a-zA-Z.@−", "0-9a-zA-Z.@-")
# => "ruby-lang@example.com"
//}

@see String#tr!, String#tr_s...

RubyVM::InstructionSequence.load_from_binary_extra_data(binary) -> String (26502.0)

バイナリフォーマットの文字列から埋め込まれたextra_dataを取り出します。

...埋め込まれたextra_dataを取り出します。

//emlist[例][ruby]{
i
seq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary("extra_data")
RubyVM::InstructionSequence.load_from_binary_extra_data(binary) # => extra_data
//}

@see RubyVM::InstructionSequence#to_binary...

Encoding::InvalidByteSequenceError#destination_encoding_name -> String (26402.0)

エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

...エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

@see Encoding::InvalidByteSequenceError#destination_encoding...

Encoding::UndefinedConversionError#destination_encoding_name -> String (26402.0)

エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

...エラーを発生させた変換の変換先のエンコーディングを文字列で返します。

@see Encoding::UndefinedConversionError#destination_encoding...

TracePoint#binding -> Binding (26402.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...発生したイベントによって生成された Binding オブジェクトを返します。


//emlist[例][ruby]{
def foo(ret)
ret
end
tr
ace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
tr
ace.enable
foo 1
//}...

絞り込み条件を変える

TracePoint#binding -> Binding | nil (26402.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...れた Binding オブジェクトを返します。

C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。

//emlist[例][ruby]{
def foo(ret)
ret
end
tr
ace = TracePoint.new(:...
...call) do |tp|
p tp.binding.local_variables # => [:ret]
end
tr
ace.enable
foo 1
//}...

TracePoint#instruction_sequence -> RubyVM::InstructionSequence (26402.0)

script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。

...script_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。

//emlist[例][ruby]{
Tr
acePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval...
...("puts 'hello'")
end
//}

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

Exception#backtrace_locations -> [Thread::Backtrace::Location] (23402.0)

バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。

...ception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。

現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。

//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if D...
...aise "#{month} is not long month"
end

def get_exception
return begin
yield
rescue => e
e
end
end

e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:i...
...n `<main>'"]
//}

@see Exception#backtrace...

Time#strftime(format) -> String (23326.0)

時刻を format 文字列に従って文字列に変換した結果を返します。

...角空白で埋める ( 1..31)
* %F: %Y-%m-%d と同等 (ISO 8601の日付フォーマット)
* %G: ISO 8601の暦週の年
* %g: ISO 8601の暦週の年の下2桁(00-99)
* %H: 24時間制の時(00-23)
* %h: %b と同等
* %I: 12時間制の時(01-12)
* %j: 年中の通算日(001-366)...
...後(AM,PM)
* %Q: 1970-01-01 00:00:00 UTC からの経過ミリ秒 (Time#strftime は対応していませんが、Date#strftime で使えます)
* %R: 24時間制の時刻。%H:%M と同等。
* %r: 12時間制の時刻。%I:%M:%S %p と同等。
* %S: 秒(00-60) (60はうるう秒)
* %s:...
...(\t)
* %U: 週を表す数。最初の日曜日が第1週の始まり(00-53)
* %u: 月曜日を1とした、曜日の数値表現 (1..7)
* %V: ISO 8601形式の暦週 (01..53)
* %v: VMS形式の日付 (%e-%^b-%4Y)
* %W: 週を表す数。最初の月曜日が第1週の始まり(00-53)
*...

String#lstrip -> String (23302.0)

文字列の先頭にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v" です。

...頭にある空白文字を全て取り除いた新しい文字列を返します。
空白文字の定義は " \t\r\n\f\v" です。

//emlist[例][ruby]{
p " abc\n".lstrip #=> "abc\n"
p "\t abc\n".lstrip #=> "abc\n"
p "abc\n".lstrip #=> "abc\n"
//}

@see String#strip, String#rstrip...

絞り込み条件を変える

String#rstrip -> String (23302.0)

文字列の末尾にある空白文字を全て取り除いた新しい文字列を返します。 空白文字の定義は " \t\r\n\f\v\0" です。

...mlist[例][ruby]{
p " abc\n".rstrip #=> " abc"
p " abc \t\r\n\0".rstrip #=> " abc"
p " abc".rstrip #=> " abc"
p " abc\0 ".rstrip #=> " abc"

str = "abc\n"
p str.rstrip #=> "abc"
p str #=> "abc\n" (元の文字列は変化しない)
//}

@see String...
...#lstrip,String#strip...
<< 1 2 3 ... > >>