クラス
-
ARGF
. class (156) - Array (2156)
- Binding (47)
- Complex (24)
- Data (6)
-
Encoding
:: Converter (84) -
Encoding
:: InvalidByteSequenceError (84) - Enumerator (132)
-
Enumerator
:: Chain (7) -
Enumerator
:: Lazy (417) -
Enumerator
:: Yielder (30) -
File
:: Stat (24) - Hash (255)
- IO (91)
- Integer (8)
- KeyError (16)
- LocalJumpError (12)
- MatchData (36)
- Method (58)
- Module (256)
- Mutex (4)
- NameError (22)
- NilClass (12)
- Numeric (86)
- Object (116)
- Proc (66)
- Random (36)
- Range (50)
- Rational (24)
-
RubyVM
:: AbstractSyntaxTree :: Node (49) -
RubyVM
:: InstructionSequence (130) - Set (3)
- String (233)
- Struct (28)
- Symbol (305)
- SyntaxError (3)
- SystemCallError (12)
- SystemExit (12)
- Thread (96)
-
Thread
:: Mutex (20) -
Thread
:: Queue (10) -
Thread
:: SizedQueue (8) - Time (140)
- TracePoint (43)
- UnboundMethod (24)
モジュール
- Enumerable (526)
- Warning (4)
キーワード
- & (12)
- * (24)
- + (12)
- - (12)
- << (24)
- <=> (24)
- == (24)
- =~ (12)
- [] (96)
- []= (36)
-
absolute
_ path (12) -
alias
_ method (4) - all? (21)
- any? (62)
- anybits? (8)
- append (8)
-
append
_ as _ bytes (1) - argv (12)
- arity (36)
-
ascii
_ only? (12) - assoc (24)
- at (12)
- attr (12)
-
attr
_ accessor (4) -
attr
_ reader (4) -
attr
_ writer (4) -
base
_ label (12) - bsearch (48)
-
bsearch
_ index (20) - bytebegin (2)
- byteend (2)
- byteindex (3)
- byteoffset (6)
- byterindex (3)
- bytes (57)
- bytesize (12)
- byteslice (36)
- bytesplice (10)
-
callee
_ id (12) - casecmp (12)
- casecmp? (9)
- children (7)
- chunk (24)
-
chunk
_ while (9) -
class
_ variables (12) - clear (12)
- clone (12)
- coerce (24)
- collect (36)
- collect! (24)
-
collect
_ concat (24) - combination (24)
- compact (20)
- compact! (12)
-
compare
_ by _ identity (12) -
compare
_ by _ identity? (12) - concat (21)
- constants (12)
- convpath (12)
- count (36)
- crypt (12)
- curry (46)
- cycle (48)
- day (12)
-
deconstruct
_ keys (13) - delete (24)
-
delete
_ at (12) -
delete
_ if (24) -
destination
_ encoding (12) -
destination
_ encoding _ name (12) - difference (7)
- dig (20)
- directory? (12)
- disasm (12)
- disassemble (12)
- drop (36)
-
drop
_ while (48) - dup (12)
- each (72)
-
each
_ byte (60) -
each
_ entry (24) -
each
_ index (24) -
each
_ key (12) -
each
_ pair (12) - eager (6)
- empty? (42)
- entries (7)
-
enum
_ for (24) - eql? (12)
- errno (12)
-
error
_ bytes (12) - eval (12)
- event (12)
- fetch (36)
-
fetch
_ values (2) - fill (72)
- filter (28)
- filter! (21)
-
filter
_ map (6) -
find
_ all (12) -
find
_ index (36) - first (36)
-
first
_ column (7) -
first
_ lineno (19) -
flat
_ map (24) - flatten (24)
- flatten! (12)
- force (12)
- friday? (12)
- ftype (12)
- getbyte (36)
- grep (12)
-
grep
_ v (10) -
group
_ by (24) - hash (12)
- id2name (12)
- imaginary (24)
- include? (12)
-
incomplete
_ input? (12) - index (36)
- inject (24)
- insert (12)
- inspect (49)
-
instance
_ methods (12) -
instance
_ variables (12) -
instruction
_ sequence (7) - intern (24)
- intersect? (4)
- intersection (6)
- join (12)
-
keep
_ if (31) - key (8)
- key? (12)
- keys (12)
- label (12)
- last (24)
-
last
_ column (7) -
last
_ lineno (7) - lazy (24)
- length (24)
-
local
_ variable _ defined? (12) -
local
_ variable _ get (12) -
local
_ variable _ set (12) -
local
_ variables (21) - map (36)
- map! (24)
-
marshal
_ dump (36) -
marshal
_ load (12) - match (12)
- match? (9)
- max (84)
-
max
_ by (48) - mday (12)
- member? (12)
- members (15)
- merge (12)
- merge! (12)
-
method
_ id (12) - methods (12)
- min (84)
-
min
_ by (48) - minmax (12)
-
minmax
_ by (24) -
module
_ function (24) - name (17)
-
named
_ captures (12) - names (12)
-
next
_ values (12) - none? (21)
- one? (21)
-
original
_ name (24) - pack (21)
- parameters (24)
- path (15)
-
peek
_ values (12) - permutation (24)
- pop (24)
- prepend (20)
-
primitive
_ convert (48) -
primitive
_ errinfo (12) - priority (12)
- priority= (12)
- private (36)
-
private
_ instance _ methods (12) -
private
_ methods (12) - product (24)
- protected (36)
-
protected
_ instance _ methods (12) -
protected
_ methods (12) - public (36)
-
public
_ instance _ methods (12) -
public
_ methods (12) - push (12)
- putback (12)
- raise (12)
- rassoc (24)
-
read
_ nonblock (22) -
readagain
_ bytes (12) - readbyte (24)
- readlines (36)
- reason (12)
- receiver (8)
- reduce (24)
- reject (48)
- reject! (36)
-
repeated
_ combination (24) -
repeated
_ permutation (24) - replace (12)
-
respond
_ to _ missing? (12) - reverse (12)
- reverse! (12)
-
reverse
_ each (24) - rindex (36)
- rotate (12)
- rotate! (12)
-
ruby2
_ keywords (18) - sample (48)
- saturday? (12)
- scrub (12)
- scrub! (12)
- select (43)
- select! (31)
- setbyte (12)
- shift (24)
- shuffle (24)
- shuffle! (24)
-
singleton
_ methods (12) - size (55)
- slice (96)
- slice! (36)
-
slice
_ after (22) -
slice
_ before (36) -
slice
_ when (11) - sort (24)
- sort! (24)
-
sort
_ by (24) -
sort
_ by! (24) -
source
_ encoding (12) -
source
_ encoding _ name (12) -
start
_ with? (6) - status (12)
- step (62)
- store (12)
- strftime (12)
- sum (18)
- synchronize (12)
- sysread (12)
- sysseek (12)
- syswrite (12)
- take (36)
-
take
_ while (60) - tally (10)
-
thread
_ variable? (12) -
thread
_ variable _ get (12) -
thread
_ variable _ set (12) - thursday? (12)
-
to
_ a (118) -
to
_ ary (24) -
to
_ binary (10) -
to
_ enum (24) -
to
_ h (19) -
to
_ proc (18) -
to
_ s (36) -
to
_ sym (24) -
transform
_ keys (20) -
transform
_ keys! (20) - transpose (12)
-
try
_ lock (12) - type (7)
- union (7)
- uniq (66)
- uniq! (24)
- unpack (12)
- unshift (12)
- update (12)
-
values
_ at (12) - warn (4)
- wday (12)
-
with
_ index (36) -
with
_ object (24) - yday (12)
- year (12)
- yield (24)
-
yield
_ self (8) - zip (48)
- | (12)
検索結果
先頭5件
-
Encoding
:: InvalidByteSequenceError # error _ bytes -> String (18203.0) -
エラー発生時に捨てられたバイト列を返します。
...][ruby]{
ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1")
begin
ec.convert("abc\xA1\xFFdef")
rescue Encoding::InvalidByteSequenceError
p $!
#=> #<Encoding::InvalidByteSequenceError: "\xA1" followed by "\xFF" on EUC-JP>
puts $!.error_bytes.dump #=> "\xA1"
puts $!.readagain_byte......s.dump #=> "\xFF"
end
//}
@see Encoding::InvalidByteSequenceError#readagain_bytes... -
String
# byterindex(pattern , offset = self . bytesize) -> Integer | nil (15303.0) -
文字列のバイト単位のインデックス offset から左に向かって pattern を探索します。 最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。 見つからなければ nil を返します。
...ンデックス offset から左に向かって pattern を探索します。
最初に見つかった部分文字列の左端のバイト単位のインデックスを返します。
見つからなければ nil を返します。
引数 pattern は探索する部分文字列または正規表現......で指定します。
offset が負の場合は、文字列の末尾から数えた位置から探索します。
byterindex と String#byteindex とでは、探索方向だけが逆になります。
完全に左右が反転した動作をするわけではありません。
探索はその開始......emlist[String#byteindex の場合][ruby]{
p "stringstring".byteindex("ing", 1) # => 3
# ing # ここから探索を始める
# ing
# ing # 右にずらしていってここで見つかる
//}
//emlist[String#byterindex の場合][ruby]{
p "stringstring".byterindex("i... -
Thread
# priority -> Integer (15303.0) -
スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。
...の
priority を引き継ぎます。
@param val スレッドの優先度を指定します。プラットフォームに依存します。
//emlist[例][ruby]{
Thread.current.priority # => 0
count1 = count2 = 0
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1
b = Thread.ne......w do
loop { count2 += 1 }
end
b.priority = -2
count1 = count2 = 0 # reset
sleep 1 # => 1
count1 # => 13809431
count2 # => 11571921
//}... -
Thread
# priority=(val) (15303.0) -
スレッドの優先度を返します。この値が大きいほど優先度が高くなります。 メインスレッドのデフォルト値は 0 です。新しく生成されたスレッドは親スレッドの priority を引き継ぎます。
...の
priority を引き継ぎます。
@param val スレッドの優先度を指定します。プラットフォームに依存します。
//emlist[例][ruby]{
Thread.current.priority # => 0
count1 = count2 = 0
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1
b = Thread.ne......w do
loop { count2 += 1 }
end
b.priority = -2
count1 = count2 = 0 # reset
sleep 1 # => 1
count1 # => 13809431
count2 # => 11571921
//}... -
RubyVM
:: InstructionSequence # to _ binary(extra _ data = nil) -> String (15209.0) -
バイナリフォーマットでシリアライズされたiseqのデータを文字列として返します。 RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。
...て返します。
RubyVM::InstructionSequence.load_from_binary メソッドでバイナリデータに対応するiseqオブジェクトを作れます。
引数の extra_data はバイナリデータと共に保存されます。
RubyVM::InstructionSequence.load_from_binary_extra_data メソッ......ry で得たバイナリデータは他のマシンに移動できません。他のバージョンや他のアーキテクチャのRubyで作られたバイナリデータは使用できません。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.to_binary("extr......都合上改行しているが実際は改行はない
# => "YARB\x02\x00\x00\x00\x03\x00\x00\x00\x16\x02\x00\x00\n\x00\x00\x00\x01
# \x00\x00\x00\x03\x00\x00\x00\x05\x00\x00\x00\x84\x01\x00\x00\x88\x01\x00
# \x00\x02\x02\x00\x00x86_64-darwin15\x00*\x00\x00\x00\x00\x00\x00\x00\x01
# \x00\x00\x00\x00... -
Encoding
:: InvalidByteSequenceError # readagain _ bytes -> String (15203.0) -
エラー発生時に読み直さなければならないバイト列を返します。
...エラー発生時に読み直さなければならないバイト列を返します。
@see Encoding::InvalidByteSequenceError#error_bytes... -
Struct
# deconstruct _ keys(array _ of _ names) -> Hash (15203.0) -
self のメンバの名前と値の組を Hash で返します。
...aram array_of_names 返り値に含めるメンバの名前の配列を指定します。nil の場合は全てのメンバを意味します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
h = joe.deconstruct_keys......, :address])
h # => {:zip=>12345, :address=>"123 Maple, Anytown NC"}
# 引数が nil の場合は全てのメンバを返します。
h = joe.deconstruct_keys(nil)
h # => {:name=>"Joseph Smith, Jr.", :address=>"123 Maple, Anytown NC", :zip=>12345}
//}
[注意] 本メソッドの記述は Struct......の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Hash
# transform _ keys -> Enumerator (12303.0) -
すべてのキーに対してブロックを呼び出した結果で置き換えたハッシュを返します。 値は変化しません。
...ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys(&:to_s) # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transfor......m_keys!
@see Hash#transform_values
@see Hash#transform_values!......@param hash 置き換え前のキーから置き換え後のキーへのハッシュを指定します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys(&:to......_s) # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transform_keys!
@see Hash#transform_values
@see Hash#transform_values!... -
Hash
# transform _ keys! -> Enumerator (12303.0) -
すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。
...return transform_keys! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_key......s!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!......param hash 置き換え前のキーから置き換え後のキーへのハッシュを指定します。
@return transform_keys! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]......{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
#......=> {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!... -
IO
# syswrite(string) -> Integer (12303.0) -
write(2) を用いて string を出力します。 string が文字列でなければ to_s による文字列化を試みます。 実際に出力できたバイト数を返します。
...write(2) を用いて string を出力します。
string が文字列でなければ to_s による文字列化を試みます。
実際に出力できたバイト数を返します。
stdio を経由しないので他の出力メソッドと混用すると思わぬ動作
をすることがあり......aram string 自身に書き込みたい文字列を指定します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
//emlist[例][ruby]{
File.open("testfile", "w+") do |f|
f.sy......swrite("ABCDE") # => 5
f.syswrite(:ABC) # => 3
end
File.read("testfile") # => "ABCDEABC"
//}... -
Object
# to _ ary -> Array (12303.0) -
オブジェクトの Array への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...オブジェクトの Array への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要......すべての場面で代置可能であるような、
* 配列そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_ary
[3,4]
end
end
it = Foo.new
p([1,2] + it) #=> [1, 2, 3, 4]
//}
@see Object#to_a,Kernel.#Array...