784件ヒット
[1-100件を表示]
(0.152秒)
別のキーワード
種類
- インスタンスメソッド (588)
- モジュール関数 (96)
- 特異メソッド (64)
- 文書 (24)
- 関数 (12)
クラス
- Array (408)
-
Fiddle
:: Pointer (24) - Integer (28)
- Numeric (12)
- Object (24)
- Random (36)
- Range (72)
- SignalException (36)
- String (12)
モジュール
- Kernel (96)
キーワード
- % (12)
- * (24)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - Integer (12)
- [] (36)
- []= (24)
- at (12)
- begin (12)
- combination (24)
- cycle (12)
-
delete
_ at (12) - end (12)
- fetch (36)
- first (48)
- flatten (12)
- flatten! (12)
- format (12)
- insert (12)
- last (48)
- new (36)
- permutation (24)
- pop (12)
-
public
_ method (12) - putc (12)
- rand (60)
-
rb
_ to _ int (12) -
repeated
_ combination (24) -
repeated
_ permutation (24) - rotate (12)
- rotate! (12)
- sample (24)
- shift (24)
- sprintf (12)
- sprintf フォーマット (12)
- srand (24)
-
to
_ i (12) -
to
_ ptr (12) -
try
_ convert (4)
検索結果
先頭5件
-
Numeric
# to _ int -> Integer (24219.0) -
self.to_i と同じです。
...self.to_i と同じです。
//emlist[例][ruby]{
(2+0i).to_int # => 2
Rational(3).to_int # => 3
//}... -
Object
# to _ int -> Integer (24213.0) -
オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの Integer への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必......が使われるすべての場面で代置可能であるような、
* 整数そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_int
1
end
end
ary = [:a, :b, :c]
p(ary[Foo.new]) # => :b
//}
@see Kernel.#Integer... -
Integer
# to _ int -> self (21207.0) -
self を返します。
...self を返します。
//emlist[][ruby]{
10.to_i # => 10
//}... -
VALUE rb
_ to _ int(VALUE val) (12232.0) -
val を to_int メソッドを使って Ruby の整数に変換します。
...val を to_int メソッドを使って Ruby の整数に変換します。... -
Kernel
. # format(format , *arg) -> String (6304.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...ormat 文字列を C 言語の sprintf と同じように解釈し、
引数をフォーマットした文字列を返します。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
=== sprintf......フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の型に対する修飾子が
ないこと、2進数の指示子(%b, %B)が存在すること、sprintf のすべての方言をサ......値以外のオブジェクトの場合 to_int メソッドによる変換を試みます。
引数として範囲内の一文字の文字列も受けつけます。文字そのものを出力します。
//emlist[][ruby]{
p sprintf("%c", 97) #=> "a"
p sprintf("%c", 'a') #=> "a"
//}
フラグ `-... -
Kernel
. # sprintf(format , *arg) -> String (6304.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...ormat 文字列を C 言語の sprintf と同じように解釈し、
引数をフォーマットした文字列を返します。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
=== sprintf......フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。ただし、short や long などの C 特有の型に対する修飾子が
ないこと、2進数の指示子(%b, %B)が存在すること、sprintf のすべての方言をサ......値以外のオブジェクトの場合 to_int メソッドによる変換を試みます。
引数として範囲内の一文字の文字列も受けつけます。文字そのものを出力します。
//emlist[][ruby]{
p sprintf("%c", 97) #=> "a"
p sprintf("%c", 'a') #=> "a"
//}
フラグ `-... -
Kernel
. # Integer(arg , base = 0) -> Integer (6236.0) -
引数を整数 (Fixnum,Bignum) に変換した結果を返します。
...頭辞を含む整数表現とみなせる文字列のみ
変換します。
数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。
@param arg 変換対象のオブジェクトです。
@param base 基数として0か2か......数) です。
@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i を持たないオブジェクトを引数に指定したか、to_int, to_i
が整数(Integerのサブクラス)を返さな......e TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(nil) # can't convert nil into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Int... -
Kernel
. # Integer(arg , base = 0 , exception: true) -> Integer | nil (6236.0) -
引数を整数 に変換した結果を返します。
...頭辞を含む整数表現とみなせる文字列のみ
変換します。
数値と文字列以外のオブジェクトに対しては arg.to_int, arg.to_i を
この順に使用して変換します。
@param arg 変換対象のオブジェクトです。
@param base 基数として0か2か......m exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。
@raise ArgumentError 整数と見なせない文字列を引数に指定した場合に発生します。
@raise TypeError メソッド to_int, to_i を......か、to_int, to_i
が整数(Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。
//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9
p Integer(... -
Object
# public _ method(name) -> Method (6218.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...thod オブジェクトを返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、 private メソッド名を引数として与えると発生します。
//emlist......[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}
@see Object#method,Object#public_send,Module#public_instance_method... -
Array
# shift -> object | nil (6212.0) -
配列の先頭の要素を取り除いてそれを返します。 引数を指定した場合はその個数だけ取り除き、それを配列で返します。
...トを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
@raise ArgumentError 引数に負の数......を指定した場合に発生します。
//emlist[例][ruby]{
a = [0, 1, 2, 3, 4]
p a.shift #=> 0
p a #=> [1, 2, 3, 4]
p [].shift #=> nil
p [].shift(1) #=> []
//}
@see Array#push, Array#pop, Array#unshift...