256件ヒット
[201-256件を表示]
(0.091秒)
別のキーワード
ライブラリ
- ビルトイン (136)
-
json
/ add / exception (12) -
net
/ http (24) - optparse (12)
- pathname (36)
- rake (12)
-
rexml
/ document (12) - win32ole (12)
クラス
- Exception (24)
- File (16)
-
Net
:: HTTPResponse (24) - OptionParser (12)
- Pathname (36)
- Proc (12)
-
REXML
:: Element (12) -
Rake
:: FileList (12) -
RubyVM
:: InstructionSequence (36) -
Thread
:: Backtrace :: Location (48) - TracePoint (12)
-
WIN32OLE
_ TYPELIB (12)
キーワード
-
absolute
_ path (24) - binread (12)
- inspect (24)
- pathmap (12)
-
program
_ name (12) -
read
_ body (24) -
set
_ backtrace (12) -
source
_ location (12) - sub (24)
- text (12)
-
to
_ json (12) -
to
_ path (8) -
to
_ s (12)
検索結果
先頭5件
-
Exception
# to _ json(*args) -> String (138.0) -
自身を 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\":\"ZeroDivisionError\",\"m\":\"divided by 0\",\"b\":[\"/path/to/test.rb:4:in `/'\",\"/path....../to/test.rb:4:in `<main>'\"]}"
end
//}
@see JSON::Generator::GeneratorMethods::Hash#to_json... -
Thread
:: Backtrace :: Location # inspect -> String (138.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.rb:9:in `... -
Thread
:: Backtrace :: Location # to _ s -> String (138.0) -
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.rb:9:in `new'
# path/to/foo.rb:9:in `<main... -
OptionParser
# program _ name -> String (126.0) -
プログラムの名前を文字列で返します。
...字列で返します。
デフォルトは $0 が使われます。
@return プログラムの名前を文字列で返します。
//emlist[例][ruby]{
require "optparse"
OptionParser.new do |opts|
p $0 # => /path/to/filename.rb
p opts.program_name # => filename
end
//}... -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (56.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...ずに一度に結果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<!doctype h"
//}
//emlist[例2 ブロックを与えて大きいファイルを取得][ruby]{
require 'net/http'
uri =......p://www.example.com/path/to/big.file')
Net::HTTP.start(uri.host, uri.port) do |http|
File.open("/path/to/big.file", "w") do |f|
# Net::HTTP#request_get と Net::HTTPResponse#read_body で少しずつ読み書き。メモリ消費が少ない。
http.request_get(uri.path) do |response|......い。
dest は obsolete です。使わないでください。
dest を指定した場合には
ボディを少しずつ取得して順次
「dest << ボディの断片」を実行します。
@param dest obsoleteな引数です。利用しないでください。
@see Net::HTTP#request_get...