ライブラリ
- ビルトイン (229)
- date (72)
- openssl (48)
- prime (108)
-
racc
/ parser (12) -
rexml
/ document (36) -
rexml
/ parsers / pullparser (24) - socket (12)
- thwait (6)
- zlib (36)
クラス
- BasicSocket (12)
- Date (72)
-
Encoding
:: Converter (12) - Enumerator (72)
- Float (22)
- LocalJumpError (12)
- Object (15)
-
OpenSSL
:: OCSP :: BasicResponse (24) -
OpenSSL
:: X509 :: CRL (24) -
Prime
:: EratosthenesGenerator (36) -
Prime
:: Generator23 (24) -
Prime
:: PseudoPrimeGenerator (24) -
Prime
:: TrialDivisionGenerator (24) -
REXML
:: Child (24) -
REXML
:: Element (12) -
REXML
:: Parsers :: PullParser (24) -
Racc
:: Parser (12) -
RubyVM
:: InstructionSequence (12) - StopIteration (12)
- String (48)
- Symbol (24)
- ThreadsWait (6)
-
Zlib
:: Inflate (12) -
Zlib
:: ZStream (24)
キーワード
- << (12)
- >> (12)
-
add
_ status (12) - empty? (12)
- feed (12)
-
flush
_ next _ in (12) -
flush
_ next _ out (12) - getpeereid (12)
-
has
_ next? (12) - next! (12)
-
next
_ day (12) -
next
_ element (12) -
next
_ float (11) -
next
_ month (12) -
next
_ sibling= (12) -
next
_ token (12) -
next
_ update (12) -
next
_ update= (12) -
next
_ values (12) -
next
_ wait (6) -
next
_ year (12) - peek (12)
-
peek
_ values (12) -
prev
_ float (11) -
previous
_ sibling= (12) -
primitive
_ errinfo (12) - reason (12)
- result (12)
- rewind (24)
- status (12)
- succ (84)
- succ! (12)
- then (7)
-
to
_ a (12) -
yield
_ self (8)
検索結果
先頭5件
-
StopIteration
# result -> object (3019.0) -
この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。
...ect = Object.new
def object.each
yield :yield1
yield :yield2
:each_returned
end
enumerator = object.to_enum
p enumerator.next #=> :yield1
p enumerator.next #=> :yield2
begin
enumerator.next
rescue StopIteration => error
p error.result #=> :each_returned
end... -
Zlib
:: Inflate # <<(string) -> self (3013.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"... -
String
# succ! -> String (3008.0) -
self を「次の」文字列に置き換えます。 「次の」文字列は、アルファベットなら 16 進数、 数字なら 10 進数とみなして計算されます。 「次の」文字列の計算では "99" → "100" のように繰り上げも行われます。 このとき負符号などは考慮されません。
...逆の動作をするメソッドはありません。
//emlist[例][ruby]{
p "aa".succ # => "ab"
# 繰り上がり
p "99".succ # => "100"
p "a9".succ # => "b0"
p "Az".succ # => "Ba"
p "zz".succ # => "aaa"
p "-9".succ # => "-10"
p "9".succ # => "10"
p "09".succ # => "10"
# アル... -
BasicSocket
# getpeereid -> [Integer , Integer] (3007.0) -
Unix ドメインソケットにおいて接続相手の euid と egid を 返します。
...です。
require 'socket'
Socket.unix_server_loop("/tmp/sock") {|s|
begin
euid, egid = s.getpeereid
# Check the connected client is myself or not.
next if euid != Process.uid
# do something about my resource.
ensure
s.close
end
}... -
Encoding
:: Converter # primitive _ errinfo -> Array (119.0) -
直前の Encoding::Converter#primitive_convert による変換の結果を保持する五要素の配列を返します。
...五要素の配列を返します。
@return [result, enc1, enc2, error_bytes, readagain_bytes] という五要素の配列
result は直前の primitive_convert の戻り値です。
それ以外の四要素は :invalid_byte_sequence か :incomplete_input か :undefined_conversion だった場合......ンコーディング、enc2 は変換先のエンコーディングです。
error_bytes はエラーの発生原因となったバイト列、readagain_bytes は先読みによって変換器内部に保持されているバイト列です。
primitive_errinfo はもっぱら Encoding::Converter#......by]{
# \xff is invalid as EUC-JP.
ec = Encoding::Converter.new("EUC-JP", "Shift_JIS")
ec.primitive_convert(src="\xff", dst="", nil, 10)
p ec.primitive_errinfo
#=> [:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", ""]
# HIRAGANA LETTER A (\xa4\xa2 in EUC-JP) is not representable in ISO-8859-1.... -
Object
# then -> Enumerator (107.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...引数としてブロックを評価し、ブロックの結果を返します。
//emlist[例][ruby]{
3.next.then {|x| x**x }.to_s # => "256"
"my string".yield_self {|s| s.upcase } # => "MY STRING"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い......プライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに......使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
Object
# yield _ self -> Enumerator (107.0) -
self を引数としてブロックを評価し、ブロックの結果を返します。
...pcase } # => "MY STRING"
3.next.yield_self {|x| x**x }.to_s # => "256"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。
//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arg......uments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに使えます。
//emlist[][ruby]{
# 条件にあうので何もしない......1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap......引数としてブロックを評価し、ブロックの結果を返します。
//emlist[例][ruby]{
3.next.then {|x| x**x }.to_s # => "256"
"my string".yield_self {|s| s.upcase } # => "MY STRING"
//}
値をメソッドチェインのパイプラインに次々と渡すのは良い......プライン][ruby]{
require 'open-uri'
require 'json'
construct_url(arguments).
yield_self {|url| URI(url).read }.
yield_self {|response| JSON.parse(response) }
//}
ブロックなしで呼び出されたときは Enumerator を返します。
例えば条件によって値を捨てるのに......使えます。
//emlist[][ruby]{
# 条件にあうので何もしない
1.yield_self.detect(&:odd?) # => 1
# 条件に合わないので値を捨てる
2.yield_self.detect(&:odd?) # => nil
//}
@see Object#tap... -
REXML
:: Child # previous _ sibling=(other) (43.0) -
other を self の前の隣接ノードとします。
...other を挿入します。
@param other 挿入するノード
//emlist[][ruby]{
require 'rexml/document'
a = REXML::Element.new("a")
b = a.add_element("b")
c = REXML::Element.new("c")
b.next_sibling = c
d = REXML::Element.new("d")
b.previous_sibling = d
p a.to_s # => "<a><d/><b/><c/></a>"
//}...