284件ヒット
[1-100件を表示]
(0.125秒)
種類
- 特異メソッド (125)
- インスタンスメソッド (117)
- 文書 (31)
- モジュール関数 (11)
クラス
- Data (6)
-
Enumerator
:: Lazy (44) - Float (16)
- IO (121)
- Integer (33)
- Matrix (11)
-
OpenSSL
:: BN (11)
モジュール
- Math (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - [] (2)
-
enum
_ for (22) -
for
_ fd (11) - frexp (11)
- new (13)
- open (22)
- pipe (44)
- pow (22)
- read (33)
- round (16)
-
ruby 1
. 6 feature (11) -
to
_ enum (22) - with (2)
検索結果
先頭5件
-
Integer
# **(other) -> Numeric (27508.0) -
算術演算子。冪(べき乗)を計算します。
...param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@ra......ise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}
結果が......数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
Matrix
# **(n) -> Matrix (27406.0) -
self の n 乗を返します。
...self の n 乗を返します。
@param n べき数の指定
@raise ExceptionForMatrix::ErrNotRegular n が 0 以下で、行列が正則でない場合に発生します... -
OpenSSL
:: BN # **(other) -> OpenSSL :: BN (24406.0) -
自身の other 乗を返します。
...自身の other 乗を返します。
@param other 指数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#mod_exp... -
Integer
# pow(other) -> Numeric (9308.0) -
算術演算子。冪(べき乗)を計算します。
...param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@ra......ise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}
結果が......数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
Integer
# pow(other , modulo) -> Integer (9308.0) -
算術演算子。冪(べき乗)を計算します。
...param other 二項演算の右側の引数(対象)
@param modulo 指定すると、計算途中に巨大な値を生成せずに (self**other) % modulo と同じ結果を返します。
@return 計算結果
@raise TypeError 2引数 pow で Integer 以外を指定した場合に発生します。
@ra......ise RangeError 2引数 pow で other に負の数を指定した場合に発生します。
//emlist[][ruby]{
2 ** 3 # => 8
2 ** 0 # => 1
0 ** 0 # => 1
3.pow(3, 8) # => 3
3.pow(3, -8) # => -5
3.pow(2, -2) # => -1
-3.pow(3, 8) # => 5
-3.pow(3, -8) # => -3
5.pow(2, -8) # => -7
//}
結果が......数になりそうなとき、警告を出したうえで Float::INFINITY を返します。
//emlist[計算を放棄して Float::INFINITY を返す例][ruby]{
p 100**9999999
# => warning: in a**b, b may be too big
# Infinity
//}
判定の閾値は変わりえます。
@see BigDecimal#power... -
ruby 1
. 6 feature (8400.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) ->......printf("%d", nil)
=> -:1:in `sprintf': no implicit conversion from nil (TypeError)
from -:1
ruby 1.6.7 (2002-03-01) [i586-linux]
=> ruby 1.6.7 (2002-07-30) [i586-linux]
"0"
: 2002-05-23 -* オプション(?)
以前まで、
#! ruby -*-......((<ruby-bugs-ja:PR#107>))
END {
p 1
END { p 2 }
}
=> ruby 1.6.5 (2001-09-19) [i586-linux]
1
=> ruby 1.6.5 (2001-11-01) [i586-linux]
1
2
: String#succ
((<ruby-talk:22557>))
p "***".succ
p "*".s... -
IO
. for _ fd(fd , mode = "r" , **opts) -> IO (6474.0) -
オープン済みのファイルディスクリプタ fd に対する新しい IO オブジェクトを生成して返します。
...ます。
IO.new, IO.for_fd はブロックを受け付けません。
=== キーワード引数
このメソッドは以下のキーワード引数を利用できます。
* :mode mode引数と同じ意味です
* :external_encoding 外部エンコーディング。"-" はデフォルト外部......別名です。
* :internal_encoding 内部エンコーディング。"-" はデフォルト内部エンコーディングの
別名です。nilなら変換しません。
* :encoding "extenc:intenc" の形で外部/内部エンコーディングを指定します。
* :textmode 真を......意味になります。
* :binmode 真を渡すと mode の "b" と同じ意味になります。
* :autoclose 偽を渡すと close時/GCでのファイナライザ呼出時に fd を close しません。
また、String#encode で説明されている :invalid => :replace などの
変換オ......
* :binmode 真を渡すと mode の "b" と同じ意味になります。
* :autoclose 偽を渡すと close時/GCでのファイナライザ呼出時に fd を close しません。
* :path 文字列を渡すと、IO#path メソッドがその値を返すようになります。
また、Str... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (6452.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......merator ではなく Enumerator::Lazy を返すようになっています。
//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
raise ArgumentError if n < 0
if block_given?
each do |*va...... *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげで、repeat の返り値は
# もとが Enumer... -
IO
. read(path , **opt) -> String | nil (6421.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
..."" を返します。例えば、IO.read(空ファイル) は "" を返します。
引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合はテキスト読み込みメソッドとして
動作します。
Kernel.#open と同様 path の先頭が "|"......出力を読み取ります。
@param path ファイル名を表す文字列か "|コマンド名" を指定します。
@param length 読み込む長さを整数で指定します。nil であるか省略した場合には、EOF まで読み込みます。
@param offset 読み込みを始める......。
@param opt ファイル path を open する時に使われるオプションをキーワード引数で指定します。
@raise Errno::EXXX path のオープン、offset 位置への設定、ファイルの読み込みに失敗した場合に発生します。
@raise ArgumentError length... -
IO
. read(path , length = nil , **opt) -> String | nil (6421.0) -
path で指定されたファイルを offset 位置から length バイト分読み込んで返します。
..."" を返します。例えば、IO.read(空ファイル) は "" を返します。
引数 length が指定された場合はバイナリ読み込みメソッド、そうでない場合はテキスト読み込みメソッドとして
動作します。
Kernel.#open と同様 path の先頭が "|"......出力を読み取ります。
@param path ファイル名を表す文字列か "|コマンド名" を指定します。
@param length 読み込む長さを整数で指定します。nil であるか省略した場合には、EOF まで読み込みます。
@param offset 読み込みを始める......。
@param opt ファイル path を open する時に使われるオプションをキーワード引数で指定します。
@raise Errno::EXXX path のオープン、offset 位置への設定、ファイルの読み込みに失敗した場合に発生します。
@raise ArgumentError length...