ライブラリ
- English (44)
- ビルトイン (656)
-
cgi
/ html (22) - csv (22)
- fiddle (11)
- logger (1)
- nkf (11)
- rake (55)
-
rake
/ loaders / makefile (11) -
rdoc
/ markup (11) -
rdoc
/ parser (11) -
rexml
/ document (22) -
rexml
/ sax2listener (11) -
rexml
/ streamlistener (11) -
ripper
/ filter (11) -
rubygems
/ dependency (11) -
rubygems
/ dependency _ list (11) - timeout (19)
-
webrick
/ httpservlet / abstract (66) -
webrick
/ httputils (88) - zlib (11)
クラス
- Array (30)
- BasicObject (55)
- CSV (22)
- Class (22)
-
Enumerator
:: Yielder (11) - Exception (22)
-
Gem
:: Dependency (11) -
Gem
:: DependencyList (11) - Method (32)
- Module (126)
- Object (110)
- Proc (11)
-
RDoc
:: Markup (11) -
RDoc
:: Parser (11) -
REXML
:: Attributes (22) -
Rake
:: MakefileLoader (11) -
RubyVM
:: InstructionSequence (77) - String (11)
-
Thread
:: Backtrace :: Location (11) - TracePoint (6)
- UnboundMethod (11)
-
WEBrick
:: HTTPServlet :: AbstractServlet (66) -
WEBrick
:: HTTPUtils :: FormData (88) -
Zlib
:: Inflate (11)
モジュール
-
CGI
:: HtmlExtension (22) - Enumerable (66)
- Kernel (77)
-
REXML
:: SAX2Listener (11) -
REXML
:: StreamListener (11) -
Rake
:: TaskManager (55) - Timeout (19)
キーワード
- ! (11)
- != (11)
-
$ DEFAULT _ INPUT (11) -
$ ERROR _ INFO (11) -
$ ERROR _ POSITION (11) -
$ LAST _ PAREN _ MATCH (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - << (22)
- <= (11)
- <=> (22)
- == (11)
- === (11)
- Application (1)
- BasicObject (11)
- Closure (11)
- Filter (11)
- Marshal フォーマット (11)
-
NEWS for Ruby 2
. 7 . 0 (5) - NKF (11)
- Numeric (11)
- [] (33)
-
absolute
_ path (11) -
add
_ special (11) -
backtrace
_ locations (11) -
base
_ label (22) - bigdecimal (11)
- bind (11)
- cgi (11)
-
cgi
/ session (11) -
class
_ variables (11) -
const
_ source _ location (5) - convert (22)
-
define
_ task (11) - disasm (11)
- disassemble (11)
-
do
_ DELETE (11) -
do
_ GET (11) -
do
_ HEAD (11) -
do
_ OPTIONS (11) -
do
_ POST (11) -
do
_ PUT (11) - each (11)
-
each
_ attribute (11) -
each
_ data (11) - entitydecl (11)
-
enum
_ for (22) - filename (11)
- filename= (11)
- html (22)
- include (11)
- include? (11)
- inherited (11)
- initialize (11)
- inspect (11)
-
instance
_ eval (22) -
instance
_ methods (11) -
instance
_ of? (11) -
instruction
_ sequence (6) - intern (11)
-
is
_ a? (11) -
kind
_ of? (11) - label (11)
- list (11)
- load (11)
- logger (11)
- lookup (11)
- max (22)
-
method
_ defined? (11) - methods (11)
- min (44)
-
minitest
/ unit (1) - name (11)
- name= (11)
- of (11)
- pack (19)
- pack テンプレート文字列 (11)
-
parse
_ files _ matching (11) - path (11)
- print (11)
-
private
_ method _ defined? (11) -
protected
_ method _ defined? (11) -
public
_ method _ defined? (11) - rdoc (11)
-
rinda
/ rinda (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
set
_ backtrace (11) -
spec
_ predecessors (11) -
start
_ prefix _ mapping (11) -
super
_ method (10) - superclass (11)
-
synthesize
_ file _ task (11) - test (22)
-
test
/ unit (1) - timeout (19)
-
to
_ ary (11) -
to
_ enum (22) -
to
_ s (11) - unpack (11)
-
webrick
/ cgi (11) - yield (11)
- メソッド呼び出し(super・ブロック付き・yield) (11)
- 制御構造 (11)
- 変数と定数 (11)
- 演算子式 (11)
検索結果
先頭5件
-
Module
# <(other) -> bool | nil (18260.0) -
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
...較では
nil を返します。
@param other 比較対象のモジュールやクラス
@raise TypeError other がクラスやモジュールではない場合に発生します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo #......=> true
p Baz < Bar # => true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil
p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}... -
rinda
/ rinda (12036.0) -
Rubyで実装されたタプルスペース(Tuple Space)を扱うためのライブラリです。
...対しては、タプルを書き込む(write)、取り出す(take)、
タプルの要素を覗き見る(read)
という操作のみが利用できます。可能な操作を限定し、定型化することで
安全な同期処理を実現します。rinda においてはタプルとは
配列も......rinda_ts.rb
require 'drb/drb'
require 'rinda/tuplespace'
uri = ARGV.shift
DRb.start_service(uri, Rinda::TupleSpace.new)
puts DRb.uri
DRb.thread.join
# rindas.rb
require 'drb/drb'
require 'rinda/rinda'
def do_it(v)
puts "do_it(#{v})"
v + v
end
uri = ARGV.shi......raise("usage: #{$0} <server_uri>")
DRb.start_service
ts = Rinda::TupleSpaceProxy.new(DRbObject.new(nil, uri))
while true
r = ts.take(['sum', nil, nil])
v = do_it(r[2])
ts.write(['ans', r[1], r[2], v])
end
# rindac.rb
require 'drb/drb'
require 'rinda/rinda'
uri... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9224.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...ception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require "date"
def check_long_month(month)
return if D......aise "#{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_exception'", "test.rb:15:i......n `<main>'"]
//}
@see Exception#backtrace... -
TracePoint
# instruction _ sequence -> RubyVM :: InstructionSequence (9224.0) -
script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。
...script_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。
//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval......("puts 'hello'")
end
//}
@raise RuntimeError :script_compiled イベントのための
イベントフックの外側で実行した場合に発生します。... -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (9218.0) -
各属性に対しブロックを呼び出します。
...ttribute オブジェクトで渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").firs......t
a.attributes.each_attribute do |attr|
p [attr.namespace, attr.name, attr.value]
end
# => ["http://example.org/foo", "att", "1"]
# => ["http://example.org/bar", "att", "2"]
# => ["", "att", "<"]
//}... -
Zlib
:: Inflate # <<(string) -> self (9206.0) -
Zlib::Inflate#inflate と同じように string を 展開ストリームに入力しますが、Zlib::Inflate オブジェクト そのものを返します。展開ストリームからの出力は、 出力バッファに保存されます。
...Zlib::Inflate#inflate と同じように string を
展開ストリームに入力しますが、Zlib::Inflate オブジェクト
そのものを返します。展開ストリームからの出力は、
出力バッファに保存されます。
require 'zlib'
cstr = "x\234\313\310OOUH+MOTH\3......15K\001\000!\251\004\276"
inz = Zlib::Inflate.new
inz << cstr[0, 10]
p inz.flush_next_out #=> "hoge fu"
inz << cstr[10..-1]
p inz.flush_next_out #=> "ga end"... -
Gem
:: Dependency # <=>(other) -> Integer (9200.0) -
self と other を Gem::Dependency#name の ASCII コードで比較して self が大きい時には正の整数、等しい時には 0、小さい時には負の整数を返します。
...self と other を Gem::Dependency#name の ASCII コードで比較して
self が大きい時には正の整数、等しい時には 0、小さい時には負の整数を返します。... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (9174.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なし......ecution expired" になります.
例 長い計算のタイムアウト
require 'timeout'
def calc_pi(min)
loop do
x = rand
y = rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)......imeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi = 3.141443
例 独自の例外を発生させるタイムアウト
#!/usr/bin/env ruby
require 'timeout'
class MYError < Exception;end
begin
Timeout.ti... -
Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object (9174.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なし......ecution expired" になります.
例 長い計算のタイムアウト
require 'timeout'
def calc_pi(min)
loop do
x = rand
y = rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)......imeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi = 3.141443
例 独自の例外を発生させるタイムアウト
#!/usr/bin/env ruby
require 'timeout'
class MYError < Exception;end
begin
Timeout.ti... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (9173.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なし......am exception_class タイムアウトした時、発生させる例外を指定します.
例 長い計算のタイムアウト
require 'timeout'
def calc_pi(min)
loop do
x = rand
y = rand
x**2 + y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0,......in
Timeout.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi = 3.141443
例 独自の例外を発生させるタイムアウト
#!/usr/bin/env ruby
require 'ti... -
Enumerator
:: Yielder # <<(object) -> () (9112.0) -
Enumerator.new で使うメソッドです。
...r::Yielder オブジェクトが渡されたブロックが実行され、
ブロック内の << が呼ばれるたびに each に渡されたブロックが
<< に渡された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y << 1
y << 2
y << 3
end
e......num.each do |v|
p v
end
# => 1
# 2
# 3
//}...