るりまサーチ

最速Rubyリファレンスマニュアル検索!
97件ヒット [1-97件を表示] (0.041秒)
トップページ > クエリ:|[x] > クエリ:next[x] > 種類:文書[x]

別のキーワード

  1. _builtin |
  2. set |
  3. ipaddr |
  4. array |
  5. integer |

検索結果

1.6.8から1.8.0への変更点(まとめ) (1525.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 は
引数チェックがゆるい。break が例外になる。

Proc.new {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'...
...* lambda および proc が返す Proc は引数チェックが厳しい。
break は実行を中断する。

lambda {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'...
...じになっています。

def foo
yield 1,2,3,4
end

foo {|a,b,c| p [a,b,c]; break }

foo( &proc {|a,b,c| p [a,b,c]; break } )

foo( &Proc.new {|a,b,c| p [a,b,c]; break } )

=> ruby 1.6.8 (2002-12-24) [i586-linux]
[1, 2, 3]...

メソッド呼び出し(super・ブロック付き・yield) (133.0)

メソッド呼び出し(super・ブロック付き・yield) * super * block * yield * block_arg * numbered_parameters * call_method

...呼び出し

//emlist[例][ruby]{
[1,2,3].each do |i| print i*2, "\n" end
[1,2,3].each {|i| print i*2, "\n" }
//}

文法:

method(arg1, arg2, ...) do [`|' 式 ... `|'] 式 ... end
method(arg1, arg2, ...) `{' [`|' 式 ... `|'] 式 ... `}'
method(arg1, arg2, ..., `&' p...
...たく別の変数 i の宣言
# ...
end
//}

以下は逆にブロック外でも有効な例です。

//emlist[][ruby]{
i = 10
[1,2,3].each do |m|
p i * m # いきなり i を使える
end
//}

ブロックの部分だけを先に定義して変数に保存しておき、後か...
...れます。

//emlist[][ruby]{
# 1引数の手続き(その働きは引数をpで印字すること)を生成し、変数pobjに格納
pobj = proc {|v|
p v
}

[1,2,3].each(&pobj) # 手続きオブジェクトをブロックの代わりに渡している
# => 1
# 2
# 3
//}

to_proc メソッ...

制御構造 (101.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などとは異なり)制御構造は式であ...
...トの各要素に対して本体を繰り返し
て実行します。これは以下の式とほぼ等価です。

(式1).each `{' `|' lhs..`|' 式2.. `}'

「ほぼ」というのは、do ... endまたは{ }による
ブロックは新しいローカル変数の有効範囲を導入...
...プの戻り値はその引数になります。


====[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.7.0 (73.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...加されました。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#tally][ruby]{
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
//}

* En...
...=> 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 #=> Enumerator
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
//}
//emlist[...
...Enumerator::Lazy#with_index][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}

* Fiber
* 新規メソッド
* Fiber#raiseメソッドが追加され、Fiber#resumeのように
resumeして、さらに例外を発...

手続きオブジェクトの挙動の詳細 (59.0)

手続きオブジェクトの挙動の詳細 * def * should_use_next * block * lambda_proc * orphan

...手続きオブジェクトの挙動の詳細
* def
* should_use_next
* block
* lambda_proc
* orphan

===[a:def] 手続きオブジェクトとは

手続きオブジェクトとはブロックをコンテキスト(ローカル変数のスコープやスタックフレーム)と
ともにオ...
...d

p foo # => 2
//}

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを中断して、呼出し元(呼び出しブロックでは yield、それ以外では Proc#call)
へジャンプし値を返すには next を使います。break や return では...
...ありません。


//emlist[例][ruby]{
def foo
f = Proc.new{
next
1
2 # この行に到達することはない
}
end

p foo().call #=> 1
//}

===[a:block] Proc オブジェクトをブロック付きメソッド呼び出しに使う

ブロック付きメソッド...

絞り込み条件を変える

リテラル (31.0)

リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent

...数表記 (n は 0-7)

: \xnn
16 進数表記 (n は 0-9,a-f)

: \cx
: \C-x
コントロール文字 (x は ASCII 文字)

: \M-x
メタ x (c | 0x80)

: \M-\C-x
メタ コントロール x

: \x
文字 x そのもの

: \unnnn
Unicode 文字(n は 0-9,a-f,A-F、16進数4桁で指定)。...
...

//emlist[][ruby]{
print <<EOS # 識別子 EOS までがリテラルになる
the string
next
line
EOS
//}

これは以下と同じです。

//emlist[][ruby]{
print " the string\n next line\n"
//}

ヒアドキュメントでは、開始ラベル `<<識別子' が文法要素とし...
...<<EOS,
3055 * 2 / 5) # <- この行はヒアドキュメントに含まれてしまう
This line is a here document.
EOS

開始ラベルを `<<-識別子' のように `-' を付けて書くことで終端
行をインデントすることができま...

ruby 1.8.4 feature (25.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...:"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...
...サンプル兼ライブラリ

#Wed Dec 7 01:02:04 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
#
# * ext/tk/README.macosx-aqua: [new document] tips to avoid the known
# bug on platform specific dialogs of Tcl/Tk Aqua on MacOS X.

MacOS X 上で Aqua 版の Tcl/Tk を用いた...
...切り捨てられていたバグの修正。

require "optparse"

puts "[#{ARGV * ', '}]"
ARGV.options do |opt|
opt.on("-n NODE") {|v| puts v }
opt.parse!
end

>ruby -v -Ku a.rb -n 時間
ruby 1.8.2 (2004-12-25) [i386-mswin32]...

NEWS for Ruby 2.0.0 (19.0)

NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...性のためまだサポートしています。
//emlist{
str.lines.with_index(1) {|line, lineno| ... } # str.lines が配列を返すのでもう動かない
str.each_line.with_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}

* IO#lines, IO#chars, IO#cod...
...exporting a
private key to PEM with a password - it has to be at least four characters
long.
* SSL/TLS support for the Next Protocol Negotiation extension. Supported
with OpenSSL 1.0.1 and higher.
* OpenSSL::OPENSSL_FIPS allows client applications to detect whether OpenSSL...
...olv
* 追加: Resolv::DNS#timeouts=
* 追加: Resolv::DNS::Config#timeouts=

* rexml
* REXML::Document#write はハッシュ引数をサポートしました
* REXML::Document#write は :encoding オプションをサポートしました。
XMLドキュメントのエンコ...

Ruby プログラムの実行 (19.0)

Ruby プログラムの実行 === Ruby プログラム

...ドを break して終了したらその値は
nil です。スタックフレーム上にないなら例外 LocalJumpError
を発生します。

next
ブロックの終わりまでジャンプ

retry 複雑だ…

==== eval, instance_eval, module_eval

これなんだっけ

=== 代入

代入と...
...ロック上での多重代入とみなされます。たと
えば以下のコードのブロック実行開始時には、

some_iterator do |a,b|
....
end

次のような操作がまず実行されます。

a, b = <some_iterator から yield された値>

==== インスタン...

NEWS for Ruby 3.0.0 (13.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...osplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 =>...
...!
* String#slice / String#[]
* String#split
* String#squeeze
* String#strip
* String#sub
* String#succ / String#next
* String#swapcase
* String#tr
* String#tr_s
* String#upcase
* Symbol
* Symbol#to_proc now returns a lambda Proc. 162...
...This should have no impact on extension libraries, but users might experience slow compilations.
* Memory view interface [EXPERIMENTAL]
* The memory view interface is a C-API set to exchange a raw memory area, such as a numeric array or a bitmap image, between extension libraries. The extensi...

絞り込み条件を変える