328件ヒット
[1-100件を表示]
(0.104秒)
別のキーワード
クラス
- Array (2)
- Enumerator (24)
- File (12)
- Hash (56)
- MatchData (4)
- Matrix (24)
-
Net
:: HTTPResponse (12) - OptionParser (144)
- Prime (12)
- Struct (12)
- TracePoint (12)
- Vector (14)
キーワード
- []= (14)
- bytebegin (2)
- byteend (2)
- eigen (12)
- eigensystem (12)
- fetch (36)
-
fetch
_ values (22) - flock (12)
-
next
_ values (12) - on (144)
-
peek
_ values (12) -
prime
_ division (12) -
return
_ value (12) -
values
_ at (12)
検索結果
先頭5件
-
Net
:: HTTPResponse # value -> nil (18262.0) -
レスポンスが 2xx(成功)でなかった場合に、対応する 例外を発生させます。
...発生させます。
@raise HTTPError レスポンスが 1xx であるか、 net/http が知らない
種類のレスポンスである場合に発生します。
@raise HTTPRetriableError レスポンスが 3xx である場合に発生します。
@raise HTTPServerException レ......発生します。
@raise HTTPFatalError レスポンスが 5xx である場合に発生します。
//emlist[例 レスポンスが 2xx(成功)][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.value # => nil
//}
//eml......ist[例 レスポンスが 2xx以外][ruby]{
require 'net/http'
uri = "http://www.example.com/invalid.html"
response = Net::HTTP.get_response(URI.parse(uri))
begin
response.value
rescue => e
e.class # => Net::HTTPServerException
e.message # => 404 "Not Found"
end
//}... -
TracePoint
# return _ value -> object (6226.0) -
メソッドやブロックの戻り値を返します。
...ます。
@raise RuntimeError :return、:c_return、:b_return イベントのためのイベ
ントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:return) do |tp|
p tp.return_value # => 1
end
tra... -
Array
# fetch _ values(*indexes) -> Array (6225.0) -
引数で指定されたインデックスに対する値の配列を返します。
...す。
@raise IndexError ブロックが与えられてない時に、範囲外のインデックスを引数で指定すると発生します。
//emlist[例][ruby]{
ary = ["a", "b", "c"]
ary.fetch_values(0, 2) # => ["a", "c"]
ary.fetch_values(-1, 1) # => ["d", "b"]
ary.fetch_values(0, 10) # =>......index 10 outside of array bounds: -3...3 (IndexError)
ary.fetch_values(0, 10) { |i| i.to_s } # => ["a", "10"]
//}
@see Array#values_at, Array#fetch... -
Array
# fetch _ values(*indexes) { |index| . . . } -> Array (6225.0) -
引数で指定されたインデックスに対する値の配列を返します。
...す。
@raise IndexError ブロックが与えられてない時に、範囲外のインデックスを引数で指定すると発生します。
//emlist[例][ruby]{
ary = ["a", "b", "c"]
ary.fetch_values(0, 2) # => ["a", "c"]
ary.fetch_values(-1, 1) # => ["d", "b"]
ary.fetch_values(0, 10) # =>......index 10 outside of array bounds: -3...3 (IndexError)
ary.fetch_values(0, 10) { |i| i.to_s } # => ["a", "10"]
//}
@see Array#values_at, Array#fetch... -
Enumerator
# next _ values -> Array (6219.0) -
「次」のオブジェクトを配列で返します。
...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_values
p e.next_values
p e.next_values
p e.next_values
p e.next_values
e = o.to_enum
p e.next
p e.next
p e.next
p e.next
p e.next
## yield args next_value......[1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}
@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#next, Enumerator#peek, Enumerator#peek_values... -
Enumerator
# peek _ values -> Array (6219.0) -
Enumerator#next_values のように「次」のオブジェクトを 配列で返しますが、列挙状態を変化させません。
...Enumerator#next_values のように「次」のオブジェクトを
配列で返しますが、列挙状態を変化させません。
Enumerator#next, Enumerator#next_values のように
現在までの列挙状態に応じて「次」のオブジェクトを返しますが、
next と異なり......r#next_values と同様
yield
と
yield nil
を区別するために使えます。
//emlist[例][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
end
e = o.to_enum
p e.peek_values #=> []
e.next
p e.peek_values #=> [1]
p e.peek_values #=> [1]
e.next
p e.peek_values #=......> [1, 2]
e.next
p e.peek_values # raises StopIteration
//}
@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#next, Enumerator#next_values, Enumerator#peek_values... -
Hash
# fetch _ values(key , . . . ) -> [object] (6219.0) -
引数で指定されたキーに関連づけられた値の配列を返します。
...す。
@raise KeyError ブロックが与えられてない時にキーの探索に失敗すると発生します。
//emlist[例][ruby]{
h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" }
h.fetch_values("cow", "cat") # => ["bovine", "feline"]
h.fetch_values("cow",......"bird") # raises KeyError
h.fetch_values("cow", "bird") { |k| k.upcase } # => ["bovine", "BIRD"]
//}
@see Hash#values_at, Hash#fetch... -
Hash
# fetch _ values(key , . . . ) { |key| . . . } -> [object] (6219.0) -
引数で指定されたキーに関連づけられた値の配列を返します。
...す。
@raise KeyError ブロックが与えられてない時にキーの探索に失敗すると発生します。
//emlist[例][ruby]{
h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" }
h.fetch_values("cow", "cat") # => ["bovine", "feline"]
h.fetch_values("cow",......"bird") # raises KeyError
h.fetch_values("cow", "bird") { |k| k.upcase } # => ["bovine", "BIRD"]
//}
@see Hash#values_at, Hash#fetch... -
Struct
# values _ at(*members) -> [object] (6219.0) -
引数で指定されたメンバの値の配列を返します。
...のインデックスを指定します。
@raise IndexError member が整数で存在しないメンバを指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar, :baz)
obj = Foo.new('FOO', 'BAR', 'BAZ')
p obj.values_at(0, 1, 2) # => ["FOO", "BAR", "BAZ"]
//}... -
Prime
# prime _ division(value , generator= Prime :: Generator23 . new) -> [[Integer , Integer]] (238.0) -
与えられた整数を素因数分解します。
...与えられた整数を素因数分解します。
@param value 素因数分解する任意の整数を指定します。
@param generator 素数生成器のインスタンスを指定します。
@return 素因数とその指数から成るペアを要素とする配列です。つまり、戻......それぞれの内部配列の第1要素 n は value の素因数、第2要素は n**e が value を割り切る最大の自然数 e です。
@raise ZeroDivisionError 与えられた数値がゼロである場合に発生します。
//emlist[例][ruby]{
require 'prime'
Prime.prime_division(12) #... -
Matrix
# eigen -> Matrix :: EigenvalueDecomposition (219.0) -
行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。
...行列の固有値と左右の固有ベクトルを保持したオブジェクトを返します。
Matrix::EigenvalueDecomposition は to_ary を定義しているため、
多重代入によって3つの行列(右固有ベクトル、固有値行列、左固有ベクトル)
を得ることがで......][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
v, d, v_inv = m.eigensystem
d.diagonal? # => true
v.inv == v_inv # => true
(v * d * v_inv).round(5) == m # => true
//}
@raise ExceptionForMatrix::ErrDimensionMismatch 行列が正方行列でない場合に発生します
@see Matrix::EigenvalueD...