ライブラリ
- ビルトイン (7)
-
irb
/ cmd / help (1) -
json
/ add / exception (1) -
net
/ http (1) -
rake
/ rdoctask (1)
クラス
-
CGI
:: Cookie (1) - Exception (2)
-
IRB
:: ExtendCommand :: Help (1) - NameError (1)
-
RDoc
:: Options (1) -
Rake
:: RDocTask (1) -
RubyVM
:: InstructionSequence (2) -
Thread
:: Backtrace :: Location (3) -
WEBrick
:: Cookie (2)
モジュール
-
Net
:: HTTPHeader (1)
検索結果
先頭5件
-
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... -
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...