るりまサーチ

最速Rubyリファレンスマニュアル検索!
1352件ヒット [1-100件を表示] (0.081秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Fiber#raise -> object (21256.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...
self
が表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。

引数を渡さない場合、RuntimeError が発生します。...
... backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}

//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fib...
...er.new do
loop do
Fiber.yield(:loop)
end
:exit
end

p f.resume # => :loop
p f.raise StopIteration # => :exit
//}...

Fiber#raise(exception, message = nil, backtrace = nil) -> object (21256.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...
self
が表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。

引数を渡さない場合、RuntimeError が発生します。...
... backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}

//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fib...
...er.new do
loop do
Fiber.yield(:loop)
end
:exit
end

p f.resume # => :loop
p f.raise StopIteration # => :exit
//}...

Fiber#raise(message) -> object (21256.0)

selfが表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

...
self
が表すファイバーが最後に Fiber.yield を呼んだ場所で例外を発生させます。

Fiber.yield が呼ばれていないかファイバーがすでに終了している場合、
FiberError が発生します。

引数を渡さない場合、RuntimeError が発生します。...
... backtrace 例外発生時のスタックトレースです。文字列の配列で指定します。

//emlist[例][ruby]{
f = Fiber.new { Fiber.yield }
f.resume
f.raise "Error!" # => Error! (RuntimeError)
//}

//emlist[ファイバー内のイテレーションを終了させる例][ruby]{
f = Fib...
...er.new do
loop do
Fiber.yield(:loop)
end
:exit
end

p f.resume # => :loop
p f.raise StopIteration # => :exit
//}...

Array#combination(n) {|c| block } -> self (6238.0)

サイズ n の組み合わせをすべて生成し、それを引数としてブロックを実行します。

...変換を試みます。

@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
a.combination(1).to_a #=> [[1],[2],[3],[4]]
a.combination(2).to_a #=> [[1,2],[...
...1,3],[1,4],[2,3],[2,4],[3,4]]
a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
a.combination(4).to_a #=> [[1,2,3,4]]
a.combination(0).to_a #=> [[]]: one combination of length 0
a.combination(5).to_a #=> [] : no combinations of length 5
//}

ブロックが与えられた場合、作...
...た配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4]
result = []
a.combination(2) {|e| result << e} # => [1,2,3,4]
result #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
//}

@see Array#permutation, Array#repeated_combination...

Array#repeated_combination(n) { |c| ... } -> self (6238.0)

サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。

...を試みます。

@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [...
...[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.repeated_combination(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],...
...3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e| r...

絞り込み条件を変える

OpenSSL::BN#mask_bits!(n) -> self (6238.0)

自身を下位 n ビットでマスクし、破壊的に変更します。

...場合は例外 OpenSSL::BNError
が発生します。

//emlist[][ruby]{
require 'openssl'

b
n = 0b1111_1111.to_bn

b
n.mask_bits!(8)
p "%b" % bn # => "11111111"

b
n.mask_bits!(3)
p "%b" % bn # => "111"
//}

@param n マスクするビット数
@raise OpenSSL::BNError 計算時エラ...

Module#public_constant(*name) -> self (6226.0)

name で指定した定数の可視性を public に変更します。

...指定した定数の可視性を public に変更します。

@param name 0 個以上の String か Symbol を指定します。

@raise NameError 存在しない定数を指定した場合に発生します。

@return self を返します。

//emlist[例][ruby]{
module SampleModule
class Samp...
...:SampleInnerClass
end

b
egin
SampleModule::SampleInnerClass
rescue => e
e # => #<NameError: private constant SampleModule::SampleInnerClass referenced>
end

module SampleModule
# => 非公開クラスであることは承知で利用するために public にする
public_constant :SampleIn...
...nerClass
end

SampleModule::SampleInnerClass # => SampleModule::SampleInnerClass
//}

@see Module#private_constant, Object#untrusted?...

StringIO#bytes {|ch| ... } -> self (6221.0)

自身から 1 バイトずつ読み込み、整数 ch に変換し、それを引数として与えられたブロックを実行します。

...変換し、それを引数として与えられたブロックを実行します。

@raise IOError 自身が読み取り不可なら発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge")
a.each_byte{|ch| p ch }
#=> 104
# 111
# 103
# 101
//}

@see IO#each_byte...

StringIO#each_byte {|ch| ... } -> self (6221.0)

自身から 1 バイトずつ読み込み、整数 ch に変換し、それを引数として与えられたブロックを実行します。

...変換し、それを引数として与えられたブロックを実行します。

@raise IOError 自身が読み取り不可なら発生します。

//emlist[例][ruby]{
require "stringio"
a = StringIO.new("hoge")
a.each_byte{|ch| p ch }
#=> 104
# 111
# 103
# 101
//}

@see IO#each_byte...

IO#binmode -> self (6220.0)

ストリームをバイナリモードにします。MSDOS などバイナリモードの存在 する OS でのみ有効です。そうでない場合このメソッドは何もしません。

...ンしかありません。

@raise Errno::EXXX モードの変更に失敗した場合に発生します。

//emlist[例][ruby]{
IO.open(IO.sysopen("testfile", "w+")) do |io|
io.binmode? # => false
io.binmode # => #<IO:fd 8>
io.binmode? # => true
end
//}

@see c:IO#io_binmode, IO#binmode?...

絞り込み条件を変える

IO#each_byte {|ch| ... } -> self (6220.0)

IO の現在位置から 1 バイトずつ読み込み、それを整数として与え、ブロックを実行します。

...読み込みメソッドとして動作します。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

//emlist[例][ruby]{
IO.write("testfile", "aあ")
File.open("testfile") do |io|
io.each_byte { |x| p x }
# => 97
# 227
# 129
# 130
end
//}...
<< 1 2 3 ... > >>