別のキーワード
種類
- インスタンスメソッド (938)
- 特異メソッド (93)
- モジュール関数 (33)
- クラス (11)
クラス
- Array (63)
- BasicObject (33)
- Bignum (3)
- Class (11)
- Complex (27)
-
Encoding
:: Converter (22) -
Enumerator
:: Lazy (55) -
Enumerator
:: Yielder (11) - Exception (22)
-
File
:: Stat (11) - Fixnum (3)
- Hash (83)
- Integer (11)
- Method (38)
- Module (104)
- Numeric (44)
- Object (99)
- Proc (50)
- Range (12)
-
RubyVM
:: InstructionSequence (88) - String (91)
- Symbol (11)
- Thread (16)
-
Thread
:: Queue (9) -
Thread
:: SizedQueue (9) - Time (11)
- TracePoint (6)
- UnboundMethod (11)
モジュール
- Comparable (22)
- Enumerable (55)
- Kernel (33)
キーワード
- != (11)
- % (11)
- << (62)
- <= (22)
- <=> (60)
- === (11)
- Numeric (11)
- [] (22)
-
absolute
_ path (11) - ancestors (11)
-
backtrace
_ locations (11) - bind (11)
- call (11)
-
chunk
_ while (11) - compile (11)
-
compile
_ file (11) - concat (19)
-
const
_ source _ location (5) - cover? (12)
-
delete
_ if (22) - disasm (11)
- disassemble (11)
- div (11)
-
drop
_ while (55) -
enum
_ for (44) - include (11)
- include? (11)
- initialize (11)
-
insert
_ output (11) - inspect (11)
-
instance
_ eval (22) -
instance
_ methods (11) -
instance
_ of? (11) -
instruction
_ sequence (6) -
is
_ a? (11) -
kind
_ of? (11) - lazy (11)
- methods (11)
- modulo (11)
- new (11)
- of (11)
- pack (19)
- path (11)
- print (11)
-
private
_ method _ defined? (11) -
protected
_ method _ defined? (11) -
public
_ method _ defined? (11) - push (18)
- reject (22)
- reject! (22)
- remainder (11)
- replacement= (11)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8) - scrub (11)
- scrub! (11)
-
set
_ backtrace (11) -
slice
_ when (11) - split (17)
-
super
_ method (10) - superclass (11)
- test (22)
-
to
_ enum (44) -
to
_ h (17) -
to
_ s (11) - unpack (11)
- yield (11)
検索結果
先頭5件
-
Comparable
# <(other) -> bool (21114.0) -
比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が負の整数を返した場合に、true を返します。 それ以外の整数を返した場合に、false を返します。
... <=> をもとにオブジェクト同士を比較します。
<=> が負の整数を返した場合に、true を返します。
それ以外の整数を返した場合に、false を返します。
@param other 自身と比較したいオブジェクトを指定します。
@raise ArgumentError <......=> が nil を返したときに発生します。
//emlist[例][ruby]{
1 < 1 # => false
1 < 2 # => true
//}... -
Complex
# <(other) -> bool (21102.0) -
@undef
@undef -
Module
# <(other) -> bool | nil (18174.0) -
比較演算子。self が other の子孫である場合、 true を返します。 self が other の先祖か同一のクラス/モジュールである場合、false を返します。
...す。
@param other 比較対象のモジュールやクラス
@raise TypeError other がクラスやモジュールではない場合に発生します。
//emlist[例][ruby]{
module Foo
end
class Bar
include Foo
end
class Baz < Bar
end
class Qux
end
p Bar < Foo # => true
p Baz < Bar #......=> true
p Baz < Foo # => true
p Baz < Qux # => nil
p Baz > Qux # => nil
p Foo < Object.new # => in `<': compared with non class/module (TypeError)
//}... -
Proc
# <<(callable) -> Proc (9208.0) -
self と引数を合成した Proc を返します。
...合成した Proc を返します。
戻り値の Proc は可変長の引数を受け取ります。
戻り値の Proc を呼び出すと、まず受け取った引数を callable に渡して呼び出し、
その戻り値を self に渡して呼び出した結果を返します。
Proc#>> とは......呼び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
f = proc { |x| x * x }
g = proc { |x| x + x }
# (3 + 3) * (3 + 3)
p (f << g).call(3) # => 36
//}
//emlist[call を定義し......anner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = proc { |data| puts "word count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => word count: 4
//}
@see Method#<<, Method#>>... -
Comparable
# <=(other) -> bool (9102.0) -
比較演算子 <=> をもとにオブジェクト同士を比較します。 <=> が負の整数か 0 を返した場合に、true を返します。 それ以外の整数を返した場合に、false を返します。
...比較演算子 <=> をもとにオブジェクト同士を比較します。
<=> が負の整数か 0 を返した場合に、true を返します。
それ以外の整数を返した場合に、false を返します。
@param other 自身と比較したいオブジェクトを指定します。......@raise ArgumentError <=> が nil を返したときに発生します。
//emlist[例][ruby]{
1 <= 0 # => false
1 <= 1 # => true
1 <= 2 # => true
//}... -
Complex
# <=(other) -> bool (9102.0) -
@undef
@undef -
Complex
# <=>(other) -> -1 | 0 | 1 | nil (9102.0) -
self の虚部がゼロで other が実数の場合、 self の実部の <=> メソッドで other と比較した結果を返します。 other が Complex で虚部がゼロの場合も同様です。
... <=> メソッドで other と比較した結果を返します。
other が Complex で虚部がゼロの場合も同様です。
その他の場合は nil を返します。
@param other 自身と比較する数値
//emlist[例][ruby]{
Complex(2, 3) <=> Complex(2, 3) #=> nil
Complex(2, 3) <=>......1 #=> nil
Complex(2) <=> 1 #=> 1
Complex(2) <=> 2 #=> 0
Complex(2) <=> 3 #=> -1
//}... -
Array
# pack(template) -> String (6258.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...配列の内容を template で指定された文字列にしたがって、
バイナリとしてパックした文字列を返します。
テンプレートは
型指定文字列とその長さ(省略時は1)を並べたものです。長さと
して * が指定された時は「残りのデ......指定文字は以下で述べる pack テンプレート文字列の通りです。
@param template 自身のバイナリとしてパックするためのテンプレートを文字列で指定します。
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の......を扱うときには
n, N, v, V を用います。
強制的にエンディアンを指定したいときは、
リトルエンディアンなら < を、
ビッグエンディアンなら >
を後ろにつけます。! と組み合わせることも可能です。
まとめると以下のよう......」の長さを
表します。型指定文字は以下で述べる pack テンプレート文字列の通りです。
buffer が指定されていれば、バッファとして使って返値として返します。
もし template の最初にオフセット (@) が指定されていれば、
結......してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。
//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}
@param template 自身のバイナリとしてパックす... -
Array
# pack(template , buffer: String . new) -> String (6258.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...配列の内容を template で指定された文字列にしたがって、
バイナリとしてパックした文字列を返します。
テンプレートは
型指定文字列とその長さ(省略時は1)を並べたものです。長さと
して * が指定された時は「残りのデ......」の長さを
表します。型指定文字は以下で述べる pack テンプレート文字列の通りです。
buffer が指定されていれば、バッファとして使って返値として返します。
もし template の最初にオフセット (@) が指定されていれば、
結......してください。
buffer のサイズ(capacity)が足りなければ、packはメモリを確保します。
//emlist[例][ruby]{
['!'].pack('@1a', buffer: 'abc') # => "a!"
['!'].pack('@5a', buffer: 'abc') # => "abc\u0000\u0000!"
//}
@param template 自身のバイナリとしてパックす... -
String
# unpack(template) -> Array (6258.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...Array#pack で生成された文字列を
テンプレート文字列 template にしたがってアンパックし、
それらの要素を含む配列を返します。
@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるもの......は、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます。「長さ」の代わりに`*'とすることで「残り全て」
を表すこともできます。
長さの意味はテ......を扱うときには
n, N, v, V を用います。
強制的にエンディアンを指定したいときは、
リトルエンディアンなら < を、
ビッグエンディアンなら >
を後ろにつけます。! と組み合わせることも可能です。
まとめると以下のよう......は、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます。「長さ」の代わりに`*'とすることで「残り全て」
を表すこともできます。
長さ... -
String
# split(sep = $ ; , limit = 0) -> [String] (6210.0) -
第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、 結果を文字列の配列で返します。 ブロックを指定すると、配列を返す代わりに分割した文字列で ブロックを呼び出します。
...第 1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、
結果を文字列の配列で返します。
第 1 引数 sep は以下のいずれかです。
: 正規表現
正規表現にマッチする部分で分割する。
特に、括弧に......あるいは空文字列にマッチする正規表現
文字列を 1 文字ずつに分割する。マルチバイト文字を認識する。
sep が正規表現で、かつその正規表現に括弧が含まれている場合には、
各括弧のパターンにマッチした文字列も配......除く
: limit < 0
分割個数の制限はなし
@param sep 文字列を分割するときのセパレータのパターン
@param limit 分割する最大個数
//emlist[例][ruby]{
p " a \t b \n c".split(/\s+/) # => ["", "a", "b", "c"]
p " a \t b \n c".split(nil) # =>......1 引数 sep で指定されたセパレータによって文字列を limit 個まで分割し、
結果を文字列の配列で返します。
ブロックを指定すると、配列を返す代わりに分割した文字列で
ブロックを呼び出します。
第 1 引数 sep は以下の......it < 0
分割個数の制限はなし
@param sep 文字列を分割するときのセパレータのパターン
@param limit 分割する最大個数
@return ブロックを渡した場合は self、ブロックなしの場合は配列
//emlist[例][ruby]{
p " a \t b \n c".spl...