256件ヒット
[101-200件を表示]
(0.156秒)
別のキーワード
ライブラリ
- ビルトイン (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件
-
RubyVM
:: InstructionSequence # inspect -> String (6126.0) -
self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。
...んだ人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.inspect # => "<RubyVM::InstructionSequence:<compiled>@<compiled>>"
//}
@see RubyVM::InstructionSequence#label,
RubyVM::InstructionSequence#path... -
Pathname
# sub(pattern) {|matched| . . . } -> Pathname (3173.0) -
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。
...しい Pathname オブジェクトを生成し、返します。
@param pattern 置き換える文字列のパターンを指定します。
@param replace pattern で指定した文字列と置き換える文字列を指定します。
//emlist[例][ruby]{
require 'pathname'
path1 = Pathname('/......usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}
@see String#sub... -
Pathname
# sub(pattern , replace) -> Pathname (3173.0) -
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。
...しい Pathname オブジェクトを生成し、返します。
@param pattern 置き換える文字列のパターンを指定します。
@param replace pattern で指定した文字列と置き換える文字列を指定します。
//emlist[例][ruby]{
require 'pathname'
path1 = Pathname('/......usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}
@see String#sub... -
Pathname
# binread(*args) -> String | nil (3120.0) -
IO.binread(self.to_s, *args)と同じです。
...ist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20, 10) # => "ne one\nThis is line "
//}
@see IO.bi... -
Exception
# set _ backtrace(errinfo) -> nil | String | [String] (245.0) -
バックトレース情報に 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 `<ma... -
REXML
:: Element # text(path = nil) -> String | nil (239.0) -
先頭のテキスト子ノードの文字列を返します。
...てください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#get_text
//emlist[][ruby]{
require 'rexml/... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (156.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... -
Proc
# source _ location -> [String , Integer] | nil (150.0) -
ソースコードのファイル名と行番号を配列で返します。
...ジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
//emlist[例][ruby]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb",......2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}
@see Method#source_location... -
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...