別のキーワード
種類
- 文書 (53)
- インスタンスメソッド (33)
- 特異メソッド (22)
クラス
- Enumerator (22)
-
OpenSSL
:: OCSP :: BasicResponse (11)
モジュール
- Psych (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - load (11)
-
next
_ values (11) - parse (11)
-
ruby 1
. 8 . 4 feature (11) - status (11)
- 制御構造 (11)
検索結果
先頭5件
-
Enumerator
# next -> object (18149.0) -
「次」のオブジェクトを返します。
...。
列挙が既に最後へ到達している場合は、
StopIteration 例外を発生します。このとき列挙状態は変化しません。
つまりもう一度 next を呼ぶと再び例外が発生します。
next メソッドによる外部列挙の状態は他のイテレータメソ......ッドによる
内部列挙には影響を与えません。
ただし、 IO#each_line のようにおおもとの列挙メカニズムが副作用を
伴っている場合には影響があり得ます。
@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#......enum.next
end
# => 120
# 121
# 122
//}
//emlist[例2][ruby]{
str = "xyz"
enum = str.each_byte
begin
puts enum.next while true
rescue StopIteration
puts "iteration reached at end"
end
# => 120
# 121
# 122
# iteration reached at end
puts enum.next... -
Enumerator
# next _ values -> Array (6215.0) -
「次」のオブジェクトを配列で返します。
...を配列で返します。
Enumerator#next とほぼ同様の挙動をします。終端まで到達した場合は
StopIteration 例外を発生させます。
このメソッドは、
yield
と
yield nil
を区別するために使えます。
next メソッドによる外部列挙の状...... IO#each_line のようにおおもとの列挙メカニズムが副作用を
伴っている場合には影響があり得ます。
//emlist[例: next と next_values の違いを][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
yield nil
yield [1, 2]
end
e = o.to_enum
p e.next......e.next
p e.next
p e.next
p e.next
## yield args next_values next
# yield [] nil
# yield 1 [1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}
@raise S... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (234.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...は Proc, Method オブジェクト限定でした。
これに伴い Proc#to_proc が追加されました。
: 終了ステータス [compat]
raise SystemExit したときに終了ステータス 1 で終了するようになりました。
((<ruby-dev:16776>))
: ((<"rescue/ensure on begi......(ChangeLogの
Tue Jun 5 16:15:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
に該当するようです)
: break and next [compat]
break, next は、引数を指定することでイテレータや yield の値を返す
ことができるようになりました。(この......クラ
スのインスタンスになりました。
=== クラス階層
: ((<File::Constants>))
File::Constants は、File クラスでなく IO クラスが include するように
なりました。((<ruby-dev:20964>))
: ((<UnboundMethod>)) [compat]
UnboundMethod クラスは Method... -
制御構造 (182.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...御構造
条件分岐:
* if
* unless
* case
繰り返し:
* while
* until
* for
* break
* next
* redo
* retry
例外処理:
* raise
* begin
その他:
* return
* BEGIN
* END
Rubyでは(Cなどとは異なり)制御構造は式であっ......った break により
while 式の戻り値をその値にすることもできます。
==== while 修飾子
//emlist[例][ruby]{
sleep(60) while io_not_ready?
//}
文法:
式 while 式
右辺の式を評価した値が真の間、左辺を繰り返し実行します。
左辺の......プの戻り値はその引数になります。
====[a:next] next
//emlist[例][ruby]{
# 空行を捨てるcat
ARGF.each_line do |line|
next if line.strip.empty?
print line
end
//}
文法:
next
next val
nextはもっとも内側のループの次の繰り返しにジ... -
NEWS for Ruby 2
. 0 . 0 (126.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...警告しなくなりました
=== 組み込みクラスの更新
* ARGF.class
* 追加: ARGF.class#codepoints, ARGF.class#each_codepoint
IO にある同名のメソッドに対応します
* Array
* 追加: Array#bsearch 二分探索します
* 非互換:
* Array#shuf......m
* openssl
* Consistently raise an error when trying to encode nil values. All instances
of OpenSSL::ASN1::Primitive now raise TypeError when calling to_der on an
instance whose value is nil. All instances of OpenSSL::ASN1::Constructive
raise NoMethodError in the same case.......or the Next Protocol Negotiation extension. Supported
with OpenSSL 1.0.1 and higher.
* OpenSSL::OPENSSL_FIPS allows client applications to detect whether OpenSSL
is FIPS-enabled. OpenSSL.fips_mode= allows turning on and off FIPS mode
manually in order to adapt to situations whe... -
OpenSSL
:: OCSP :: BasicResponse # status -> [[OpenSSL :: OCSP :: CertificateId , Integer , Integer , Time|nil , Time , Time|nil , [OpenSSL :: X509 :: Extension]]] (112.0) -
証明書の状態の問い合わせの結果を返します。
...ROMISE
* OpenSSL::OCSP::REVOKED_STATUS_CACOMPROMISE
* OpenSSL::OCSP::REVOKED_STATUS_AFFILIATIONCHANGED
* OpenSSL::OCSP::REVOKED_STATUS_SUPERSEDED
* OpenSSL::OCSP::REVOKED_STATUS_CESSATIONOFOPERATION
* OpenSSL::OCSP::REVOKED_STATUS_CERTIFICATEHOLD
* OpenSSL::OCSP::REVOKED_STATUS_REMOVEFRO......# update time
# 2011-07-06 05:24:43 UTC, # next update time
# []] # extensions
# ]
@raise OpenSSL::OCSP::OCSPError ステータスの読み出しに失敗した場合に発生します... -
NEWS for Ruby 3
. 0 . 0 (84.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs......anged to return `true` or `false`. 17371
//emlist{
0 => a
p a #=> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}
* Find-pattern is added. [EXPERIMENTAL]
16828
//emlist{
case ["a", 1, "b", "c", 2, "d......partition
* String#reverse
* String#rjust
* String#rpartition
* String#rstrip
* String#scrub
* String#slice!
* String#slice / String#[]
* String#split
* String#squeeze
* String#strip
* String#sub
* String#succ / String#next... -
ruby 1
. 8 . 4 feature (48.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
.../File.join [bug]>))
* ((<ruby 1.8.4 feature/Thread#pass [bug]>))
* ((<ruby 1.8.4 feature/Module#const_missing [bug]>))
* ((<ruby 1.8.4 feature/IO [bug]>))
* ((<ruby 1.8.4 feature/添付ライブラリ>))
* ((<ruby 1.8.4 feature/"Ruby/Tk">))
* ((<ruby 1.8.4 feature/REXML [compat]>))
* ((<......:"bar?"
# => ruby 1.8.4 (2005-12-22) [i686-linux]
:foo!
:bar?
4) :$- always treats next character literally:
p eval(":$-\n") # => :"$-\n"
p :$-( # => :"$-("
p :$- # => :"$- "
p :$-#.ob......separate section).
#
# * test/openssl/test_x509ext.rb: new file.
#
# ?
#Tue Nov 01 10:50:17 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
#
# * ext/openssl/extconf.rb: should check ERR_peek_last_error().
# [ruby-dev:27597]
#
# * ext/openssl/ossl.c (ossl_raise): ditto.
#
#... -
NEWS for Ruby 2
. 7 . 0 (42.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...omparable#clampや定数やDSLなどで便利かもしれません。
14799
//emlist[][ruby]{
ary[..3] # identical to ary[0..3]
case RUBY_VERSION
when ..."2.4" then puts "EOL"
# ...
end
age.clamp(..100)
where(sales: ..100)
//}
* 「$;」にnil以外の値を設定すると警告が出る......ュメントの識別子の引用符は同じ行で閉じる必要があります。
//emlist{
<<"EOS
" # This had been warned since 2.4; Now it raises a SyntaxError
EOS
//}
* フリップフロップが非推奨になったのが元に戻されました。 5400
* 以下のような場所に......Enumerator.produce][ruby]{
require "date"
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.detect(&:tuesday?) #=> next Tuesday
//}
//emlist[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
p e.class... -
Psych
. load(yaml , filename = nil , fallback = false) -> object (18.0) -
YAML ドキュメントを Ruby のデータ構造(オブジェクト)に変換します。
...メント(文字列 or IO オブジェクト)
@param filename Psych::SyntaxError 発生時にファイル名として表示する文字列。
@param fallback 引数 yaml に空のYAMLを指定した場合の戻り値を指定します。デフォルトは false です。
@raise Psych::SyntaxError YA......SyntaxError => ex
p ex.file # => 'file.txt'
p ex.message # => "(file.txt): found character that cannot start any token while scanning for the next token at line 1 column 5"
end
//}
キーワード引数 symbolize_names に true を指定した場合はハッシュのキー
を Symbol に変... -
Psych
. load(yaml , filename = nil , fallback: false , symbolize _ names: false) -> object (18.0) -
YAML ドキュメントを Ruby のデータ構造(オブジェクト)に変換します。
...返します。
filename はパース中に発生した例外のメッセージに用います。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename Psych::SyntaxError 発生時にファイル名として表示する文字列。
@param fallback 引数 yaml に......true を指定した場合は変換します。デフォルトでは
文字列に変換されます。
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
@see Psych.parse
//emlist[例][ruby]{
Psych......SyntaxError => ex
p ex.file # => 'file.txt'
p ex.message # => "(file.txt): found character that cannot start any token while scanning for the next token at line 1 column 5"
end
//}
キーワード引数 symbolize_names に true を指定した場合はハッシュのキー
を Symbol に変... -
Psych
. parse(yaml , filename = nil) -> Psych :: Nodes :: Document (18.0) -
YAML ドキュメントをパースし、YAML の AST を返します。
...:Nodes を参照してください。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename Psych::SyntaxError 発生時にファイル名として表示する文字列。
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに......("---\n - a\n - b") # => #<Psych::Nodes::Document:...>
begin
Psych.parse("--- `", "file.txt")
rescue Psych::SyntaxError => ex
p ex.file # => 'file.txt'
p ex.message # => "(file.txt): found character that cannot start any token while scanning for the next token at line 1 column 5"
end
//}...