るりまサーチ (Ruby 2.5.0)

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

別のキーワード

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

検索結果

Rake::RDocTask#main -> String (54610.0)

メインとして使用されるファイル名を返します。

メインとして使用されるファイル名を返します。

RDoc::Options#main_page -> String | nil (18658.0)

コマンドライン引数の --main オプションで指定したファイル名、クラス/モ ジュール名を返します。

コマンドライン引数の --main オプションで指定したファイル名、クラス/モ
ジュール名を返します。

指定しなかった場合は nil を返します。

Net::HTTPHeader#main_type -> String|nil (18628.0)

"text/html" における "text" のようなタイプを表す 文字列を返します。

"text/html" における "text" のようなタイプを表す
文字列を返します。

Content-Type: ヘッダフィールドが存在しない場合には nil を返します。

//emlist[例][ruby]{
require 'net/http'

uri = URI.parse('http://www.example.com/index.html')
res = Net::HTTP.get_response(uri)
res.main_type # => "text"
//}

CGI::Cookie#domain -> String (18607.0)

クッキーを適用するドメインを返します。

クッキーを適用するドメインを返します。

WEBrick::Cookie#domain -> String (18607.0)

ドメイン名を文字列で表すアクセサです。

ドメイン名を文字列で表すアクセサです。

@param value ドメイン名を表す文字列を指定します。

絞り込み条件を変える

WEBrick::Cookie#domain=(value) (18307.0)

ドメイン名を文字列で表すアクセサです。

ドメイン名を文字列で表すアクセサです。

@param value ドメイン名を表す文字列を指定します。

Exception#set_backtrace(errinfo) -> nil | String | [String] (682.0)

バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。

バックトレース情報に errinfo を設定し、設定されたバックトレース
情報を返します。

@param errinfo nil、String あるいは String の配列のいずれかを指定します。

//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
$!.backtrace # => ["/path/to/test.rb:5:in `rescue in <main>'", "/path/to/test.rb:2:in `<main>'"]
$!.se...

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

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

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

返される文字列は Ruby が捕捉されなかった例外を標準エラー出力に出力するときと
同じ形式です。
そのため、メソッド呼び出し時に $stderr が変更されておらず、$stderr.tty? が真の場合は
エスケープシーケンスによる文字装飾がついています。

[注意] このメソッドは実験的な機能として提供されています。仕様が変更に
なる可能性があります。
そして実際に、キーワード引数 highlight と order は 2.5.1 で追加されました。

@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。...

NameError#to_s -> String (343.0)

例外オブジェクトを文字列に変換して返します。

例外オブジェクトを文字列に変換して返します。

例:

begin
foobar
rescue NameError => err
p err # => #<NameError: undefined local variable or method `foobar' for main:Object>
p err.to_s # => "undefined local variable or method `foobar' for main:Object"
end

RubyVM::InstructionSequence#label -> String (343.0)

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。

self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、
モジュール名などで構成されます。

トップレベルでは "<main>" を返します。self を文字列から作成していた場合
は "<compiled>" を返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"

例2: R...

絞り込み条件を変える

Exception#to_json(*args) -> String (325.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

//emlist[例][ruby]{
require "json/add/core"

begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivis...

RubyVM::InstructionSequence#base_label -> String (325.0)

self が表す命令シーケンスの基本ラベルを返します。

self が表す命令シーケンスの基本ラベルを返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "h...

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

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

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

# => init...

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

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

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

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

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

self が表すフレームを 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/foo.rb:5:in `initialize'
# path/to/foo...

絞り込み条件を変える

IRB::ExtendCommand::Help#execute(*names) -> nil (94.0)

RI から Ruby のドキュメントを参照します。

RI から Ruby のドキュメントを参照します。

irb(main):001:0> help String#match
...

@param names 参照したいクラス名やメソッド名などを文字列で指定します。

names を指定しなかった場合は、RI を対話的なモードで起動します。メソッド
名などを入力する事でドキュメントの検索が行えます。入力のタブ補完をする
事ができます。また、空行を入力する事で irb のプロンプトに戻る事ができま
す。

irb(main):001:0> help

Enter the method name you want to look...

Module#autoload(const_name, feature) -> nil (40.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。

@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり、self の直下に定...