409件ヒット
[1-100件を表示]
(0.039秒)
別のキーワード
クラス
-
ARGF
. class (12) - Array (48)
- Enumerator (12)
- Integer (12)
- MatchData (24)
- Matrix (24)
- Object (48)
- Proc (7)
- Range (1)
-
RubyVM
:: InstructionSequence (12) - String (175)
- StringScanner (24)
-
Thread
:: SizedQueue (10)
キーワード
- << (7)
- [] (72)
- binmode (12)
-
bit
_ length (12) - bsearch (24)
- byterindex (3)
- clear (12)
- close (10)
-
each
_ grapheme _ cluster (16) -
each
_ index (24) -
enum
_ for (24) - length (12)
- minor (24)
- rindex (12)
- slice (72)
- terminate (12)
-
to
_ a (12) -
to
_ enum (24)
検索結果
先頭5件
-
Enumerator
# size -> Integer | Float :: INFINITY | nil (18142.0) -
self の要素数を返します。
...
self の要素数を返します。
要素数が無限の場合は Float::INFINITY を返します。
Enumerator.new に Proc オブジェクトを指定していた場合はその
実行結果を返します。呼び出した時に要素数が不明であった場合は nil を返し
ます。
/....../emlist[例][ruby]{
(1..100).to_a.permutation(4).size # => 94109400
loop.size # => Float::INFINITY
(1..100).drop_while.size # => nil
//}
@see Enumerator.new... -
Range
# size -> Integer | Float :: INFINITY | nil (18138.0) -
範囲内の要素数を返します。
...Error が発生します。
@raise TypeError self がイテレート可能でない場合に発生します。
//emlist[例][ruby]{
(10..20).size # => 11
("a".."z").size # => nil
(1..).size # => Infinity
(-Float::INFINITY..Float::INFINITY).size # => can't iterate from Float (TypeError)
/... -
MatchData
# size -> Integer (15146.0) -
部分文字列の数を返します(self.to_a.size と同じです)。
...部分文字列の数を返します(self.to_a.size と同じです)。
//emlist[例][ruby]{
/(foo)(bar)(BAZ)?/ =~ "foobarbaz"
p $~.size # => 4
//}... -
Thread
:: SizedQueue # close -> self (3108.0) -
キューを close します。詳しくは Thread::Queue#close を参照してください。
...ブジェクトを追加するスレッドを待機している場合は
ClosedQueueError が発生して中断されます。
//emlist[例][ruby]{
q = SizedQueue.new(4)
[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }
q.closed? # => false
q.close
q.closed? # => true
//}
@see Thr... -
RubyVM
:: InstructionSequence # to _ a -> Array (3053.0) -
self の情報を 14 要素の配列にして返します。
...
self の情報を 14 要素の配列にして返します。
命令シーケンスを以下の情報で表します。
: magic
データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。
: major_version
命令シーケンスのメジャーバー......。常に 1。
: misc
以下の要素から構成される Hash オブジェクト。
:arg_size: メソッド、ブロックが取る引数の総数(1 つもない場合は 0)。
:local_size: ローカル変数の総数 + 1。
:stack_max: スタックの深さ。(SystemStackError......の配列の配列。
//emlist[例][ruby]{
require 'pp'
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
pp iseq.to_a
# ※ Ruby 2.5.0 での実行結果
# => ["YARVInstructionSequence/SimpleDataFormat",
# 2,
# 0,
# 1,
# {:arg_size=>0, :local_size=>2, :stack_max=>2},
# "<compiled>",
# "<... -
Matrix
# minor(from _ row , row _ size , from _ col , col _ size) -> Matrix (237.0) -
selfの部分行列を返します。
...
selfの部分行列を返します。
自分自身の部分行列を返します。
ただし、パラメータは次の方法で指定します。
(1) 開始行番号, 行の大きさ, 開始列番号, 列の大きさ
(2) 開始行番号..終了行番号, 開始列番号..終了列番号
@pa......from_row 部分行列の開始行(0オリジンで指定)
@param row_size 部分行列の行サイズ
@param from_col 部分行列の開始列(0オリジンで指定)
@param col_size 部分行列の列サイズ
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3, 4, 5]
a2 = [11, 12, 13, 14, 1... -
String
# rindex(pattern , pos = self . size) -> Integer | nil (221.0) -
文字列のインデックス pos から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のインデックスを返します。 見つからなければ nil を返します。
...。
//emlist[String#index の場合][ruby]{
p "stringstring".index("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#rindex の場合][ruby]{
p "stringstring".rindex("ing", -1)......かる
//}
@param pattern 探索する部分文字列または正規表現
@param pos 探索を始めるインデックス
//emlist[例][ruby]{
p "astrochemistry".rindex("str") # => 10
p "character".rindex(?c) # => 5
p "regexprindex".rindex(/e.*x/, 2) # => 1
p... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (220.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...mlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("in......pattern 探索する部分文字列または正規表現
@param offset 探索を始めるバイト単位のインデックス
//emlist[例][ruby]{
'foo'.byterindex('f') # => 0
'foo'.byterindex('o') # => 2
'foo'.byterindex('oo') # => 1
'foo'.byterindex('ooo') # => nil
'foo'.byterindex(/f/) #... -
ARGF
. class # binmode -> self (142.0) -
self をバイナリモードにします。一度バイナリモードになった後は非バイナリ モードに戻る事はできません。
...
self をバイナリモードにします。一度バイナリモードになった後は非バイナリ
モードに戻る事はできません。
バイナリモード下では以下のように動作します。
* 改行の変換を停止する
* 文字エンコーディングの変換を停......28B
# test1.png + test2.png = 292B
# $ ruby test.rb test1.png test2.png
ARGF.binmode
ARGF.read.size # => 292
例:
# test1.png - 164B
# test2.png - 128B
# test1.png + test2.png = 292B
# $ ruby test.rb test1.png test2.png
ARGF.read.size # => 290
@see IO#binmode, ARGF.class#bi... -
StringScanner
# clear -> self (127.0) -
スキャンポインタを文字列末尾後まで進め、マッチ記録を捨てます。
...スキャンポインタを文字列末尾後まで進め、マッチ記録を捨てます。
@return self を返します。
pos = self.string.size と同じ動作です。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w+/) # => "test"
s.matched # => "... -
StringScanner
# terminate -> self (127.0) -
スキャンポインタを文字列末尾後まで進め、マッチ記録を捨てます。
...スキャンポインタを文字列末尾後まで進め、マッチ記録を捨てます。
@return self を返します。
pos = self.string.size と同じ動作です。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.scan(/\w+/) # => "test"
s.matched # => "...