1375件ヒット
[1-100件を表示]
(0.137秒)
ライブラリ
クラス
- Array (135)
-
Benchmark
:: Tms (11) - BigDecimal (11)
- Bignum (6)
- Date (11)
-
Encoding
:: Converter (44) -
Enumerator
:: Lazy (107) - Fixnum (6)
- Float (22)
- Hash (67)
- Integer (55)
- Module (44)
- Numeric (44)
- Object (44)
-
OpenSSL
:: BN (22) -
Psych
:: Handler (11) -
REXML
:: DocType (11) -
REXML
:: Entity (11) -
Rake
:: FileList (11) - Range (24)
- String (34)
- Struct (34)
- Time (44)
-
Zlib
:: GzipReader (33)
モジュール
- Enumerable (513)
- TSort (20)
キーワード
- ** (11)
- chunk (22)
-
class
_ eval (22) - collect (11)
- count (66)
-
default
_ proc= (11) -
delete
_ if (11) - detect (22)
- divmod (22)
-
each
_ byte (11) -
each
_ strongly _ connected _ component _ from (10) -
enum
_ for (22) - filter (24)
- filter! (18)
- find (22)
-
find
_ all (22) -
find
_ index (33) - format (11)
-
group
_ by (22) - include (11)
-
keep
_ if (33) - lineno= (11)
- map (11)
- max (44)
-
max
_ by (44) - min (44)
-
min
_ by (44) - minmax (22)
-
minmax
_ by (22) -
mod
_ mul (11) -
mod
_ sub (11) -
module
_ eval (22) - modulo (50)
- nonzero? (11)
- pack (19)
- partition (22)
- pow (22)
-
primitive
_ convert (44) - reject (33)
- reject! (11)
- scanf (12)
- select (44)
- select! (33)
-
slice
_ after (20) -
slice
_ before (33) -
slice
_ when (10) - sort (22)
-
sort
_ by! (11) -
start
_ document (11) - step (12)
- strftime (22)
- subsec (11)
-
to
_ enum (22) -
to
_ h (17) -
tsort
_ each (10) -
tv
_ usec (11) - ungetc (11)
- uniq (22)
- unnormalized (11)
- unpack (11)
- usec (11)
-
values
_ at (11) - write (11)
検索結果
先頭5件
-
Bignum
# %(other) -> Fixnum | Bignum | Float (21301.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Fixnum
# %(other) -> Fixnum | Bignum | Float (21301.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Numeric
# %(other) -> Numeric (21207.0) -
self を other で割った余り r を返します。
...q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。
@param other 自身を割る数を指定します。
//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4)......#=> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}
@see Numeric#divmod, Numeric#remainder... -
String
# %(args) -> String (18299.0) -
printf と同じ規則に従って args をフォーマットします。
...turn フォーマットされた文字列
//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "i = %o" % 10 # => "i = 12"
p "i = %#d" % 10 # => "i = 10"
p "i = %#x" % 10 # => "i = 0xa"
p "i = %#o" % 10 # => "i = 012"
p "%d" %......10"
p "%d,%o" % [10, 10] # => "10,12"
//}
=== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の型に対する修飾子が
ないこと、2進数の指示子(%b, %B)が......在すること、sprintf のすべての方言をサ
ポートしていないこと(%': 3桁区切り)などの違いがあります。
Ruby には整数の大きさに上限がないので、%b, %B, %o, %x, %X
に負の数を与えると (左側に無限に1が続くとみなせるので)
..f の... -
Integer
# %(other) -> Numeric (18225.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
//emlist[][ruby]{
13 % 4 # => 1
13 % -4 # => -3
-13 % 4 # => 3
-13 % -4 # => -1
//}
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Range
# %(s) -> Enumerator (18201.0) -
範囲内の要素を s おきに繰り返します。
...きます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返......します。(例: String の Range)
//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# => "a"
# "c"
# "e"
//}... -
Range
# %(s) -> Enumerator :: ArithmeticSequence (18201.0) -
範囲内の要素を s おきに繰り返します。
...きます。
@return ブロックを指定した時は self を返します。
@return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@return ブロックを指定しなかったその他の Range の時は Enumerator を返......します。(例: String の Range)
//emlist[例][ruby]{
("a" .. "f").step(2) {|v| p v}
# => "a"
# "c"
# "e"
//}... -
Numeric
# modulo(other) -> Numeric (9107.0) -
self を other で割った余り r を返します。
...q は、Numeric#div (あるいは 「/」)で求められます。
modulo はメソッド % の呼び出しとして定義されています。
@param other 自身を割る数を指定します。
//emlist[例][ruby]{
p 13.modulo(4) #=> 1
p (11.5).modulo(3.5) #=> 1.0
p 13.modulo(-4)......#=> -3
p (-13).modulo(4) #=> 3
p (-13).modulo(-4) #=> -1
p (-11).modulo(3.5) #=> 3.0
//}
@see Numeric#divmod, Numeric#remainder... -
Bignum
# modulo(other) -> Fixnum | Bignum | Float (9101.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Fixnum
# modulo(other) -> Fixnum | Bignum | Float (9101.0) -
算術演算子。剰余を計算します。
...算術演算子。剰余を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
String
# unpack(template) -> Array (6479.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...の要素を含む配列を返します。
@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表......big endian unsigned 16bit
N: big endian unsigned 32bit
v: little endian unsigned 16bit
V: little endian unsigned 32bit
//}
: エンディアン依存、整数サイズ依存 (C の構造体などに適切)
//emlist{
s!: signed short
S!: unsigned short
i,i!: signed int
I,I!: unsigned i......long
L!: unsigned long
q!: signed long long
Q!: unsigned long long
j,j!: intptr_t
J,J!: uintptr_t
//}
: エンディアン依存、整数サイズ非依存 (C99 の stdint.h にある厳密な幅を持つ整数型に適切)
//emlist{
s: int16_t
S: uint16_t
l: int32_t
L: uint32_t......素を含む配列を返します。
@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ... -
Object
# enum _ for(method = :each , *args) -> Enumerator (6213.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable......def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end... -
Object
# enum _ for(method = :each , *args) {|*args| . . . } -> Enumerator (6213.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable......def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end...