ライブラリ
クラス
-
ARGF
. class (60) - Addrinfo (24)
- CSV (156)
-
CSV
:: Table (84) - Dir (12)
- ERB (36)
-
Encoding
:: Converter (12) - Exception (12)
- File (12)
-
File
:: Stat (48) - IO (130)
-
IRB
:: Context (24) -
JSON
:: Parser (24) - Method (14)
- Module (12)
-
Net
:: HTTP (96) -
Net
:: HTTPGenericRequest (24) -
Net
:: HTTPResponse (48) - Object (30)
- Pathname (12)
- Socket (12)
- String (12)
- StringIO (84)
- Thread (247)
-
Thread
:: Backtrace :: Location (84) -
Thread
:: ConditionVariable (24) -
Thread
:: Mutex (50) -
Thread
:: Queue (106) -
Thread
:: SizedQueue (70) - ThreadGroup (24)
キーワード
- << (7)
- >> (7)
- [] (12)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (12) -
absolute
_ path (12) - add (12)
-
add
_ trace _ func (12) -
attr
_ reader (12) - backtrace (12)
-
backtrace
_ locations (36) -
base
_ label (12) - binread (12)
- birthtime (12)
- body (12)
-
body
_ stream (12) -
body
_ stream= (12) - broadcast (12)
- clear (12)
- close (10)
-
close
_ write (12) - closed? (22)
- connect (12)
-
connect
_ from (24) - convert (36)
- count (12)
-
def
_ class (12) - deq (24)
- empty? (24)
- entity (12)
- fdatasync (12)
- fetch (8)
-
field
_ size _ limit (12) - filename (24)
- filename= (12)
- flock (12)
- get2 (24)
- gets (12)
-
header
_ converters (12) - headers (12)
-
ignore
_ deadlock= (4) - inspect (36)
- key? (12)
- label (12)
- length (24)
- lineno (12)
- list (12)
- locked? (10)
- max (12)
- max= (12)
- name= (10)
-
num
_ waiting (12) - owned? (10)
- parse (12)
- path (24)
- pop (24)
- post2 (24)
- pread (8)
-
primitive
_ errinfo (12) - priority (12)
- priority= (12)
- push (12)
- puts (12)
- pwrite (8)
-
read
_ body (24) - readable? (12)
-
readable
_ real? (12) - readbyte (36)
- readchar (24)
- readline (24)
- readlines (60)
- reopen (24)
-
report
_ on _ exception (9) -
report
_ on _ exception= (9) -
request
_ get (24) -
request
_ post (24) -
row
_ sep (12) - run (12)
-
safe
_ level (7) -
set
_ encoding _ by _ bom (6) -
set
_ trace _ func (12) - shift (36)
- signal (12)
- size (24)
- sleep (10)
- source (12)
- stop? (12)
- synchronize (10)
- syswrite (12)
- then (14)
-
thread
_ variable _ set (12) -
to
_ csv (12) -
to
_ s (32) -
try
_ lock (10) -
use
_ readline (12) -
use
_ readline? (12) -
wait
_ readable (12) - wakeup (12)
-
world
_ readable? (12) - write (12)
-
yield
_ self (16)
検索結果
先頭5件
-
Thread
:: Backtrace :: Location # absolute _ path -> String (12107.0) -
self が表すフレームの絶対パスを返します。
...list[例][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.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Location......#path... -
Thread
:: Backtrace :: Location # path -> String (12107.0) -
self が表すフレームのファイル名を返します。
...self が表すフレームのファイル名を返します。
例: Thread::Backtrace::Location の例1を用いた例
//emlist[][ruby]{
loc = c(0..1).first
loc.path # => "caller_locations.rb"
//}
@see Thread::Backtrace::Location#absolute_path... -
Thread
:: Queue # length -> Integer (12107.0) -
キューの長さを返します。
...キューの長さを返します。
//emlist[例][ruby]{
require 'thread'
q = Queue.new
[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }
q.length # => 4
//}......キューの長さを返します。
//emlist[例][ruby]{
q = Queue.new
[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }
q.length # => 4
//}... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9307.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ption#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if Dat......month, -1).day == 31
raise "#{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_ex......ception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtrace... -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (9307.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thread::Backtrace......::Location... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (9307.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
...トレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフ......locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]{
thread = Thread.new { sleep 1 }
thread.run
thread.backtrace_locations # => ["/path/to/test.rb:1:in `sleep'", "/path/to/test.rb:1:in `block in <main>'"]
//}
@see Thread::Backtrace......::Location... -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (9233.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...t[例1 ブロックを与えずに一度に結果取得][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......t/http'
uri = URI.parse('http://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|
response.read_body do |s|
f.write(s)
end
end
end
end
//}
一度ブロックを与えずにこのメソッドを呼んだ場合には、
次からはすでに読みだしたボディを文字列として
返します。また一度ブロックを与... -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (9233.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
...t[例1 ブロックを与えずに一度に結果取得][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......t/http'
uri = URI.parse('http://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|
response.read_body do |s|
f.write(s)
end
end
end
end
//}
一度ブロックを与えずにこのメソッドを呼んだ場合には、
次からはすでに読みだしたボディを文字列として
返します。また一度ブロックを与... -
File
:: Stat # world _ readable? -> Integer | nil (9207.0) -
全てのユーザから読めるならば、そのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
...ミッションを表す
整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
//emlist[][ruby]{
m = File.stat("/etc/passwd").world_readable? # => 420
sprintf("%o", m) # => "644"
//}...