種類
- インスタンスメソッド (100)
- 特異メソッド (11)
- 文書 (10)
ライブラリ
- ビルトイン (34)
-
fiddle
/ import (33) - set (33)
- win32ole (11)
クラス
- Array (12)
- Object (11)
- Regexp (11)
- Set (33)
-
WIN32OLE
_ TYPE (11)
モジュール
-
Fiddle
:: Importer (33)
キーワード
- + (11)
-
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (4) -
ole
_ type (11) - sizeof (11)
-
to
_ regexp (11) - typealias (11)
- | (17)
検索結果
先頭5件
-
Regexp
. union(*pattern) -> Regexp (18315.0) -
引数として与えた pattern を選択 | で連結し、Regexp として返します。 結果の Regexp は与えた pattern のどれかにマッチする場合にマッチするものになります。
....union(/a/, /b/, /c/) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
//}
引数を一つだけ与える場合は、Array を与えても Regexp を生成します。
つまり、以下のように書くことができます。
//emlist[][ruby]{
arr = [/a/, /b/, /c/]
p Regexp.union(arr) # => /(?-mix:a)|(?-m......ix:b)|(?-mix:c)/
# 1.8.7 より前は、以下のように書く必要があった
p Regexp.union(*arr) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
//}
pattern は Regexp または String で与えます。
String で与えた場合、それ自身と等しい文字列にマッチするものと解釈さ......ます。
//emlist[][ruby]{
p Regexp.union("a", "?", "b") # => /a|\?|b/
p Regexp.union(/a/, "*") # => /(?-mix:a)|\*/
//}
引数をひとつも与えなかった場合、決してマッチしない Regexp を返します。
//emlist[][ruby]{
p Regexp.union() # => /(?!)/
//}
結果の Regexp が... -
Array
# union(*other _ arrays) -> Array (18219.0) -
集合の和演算です。self と other_arrays の配列にどれかに含まれる要素を 全て含む新しい配列を返します。重複する要素は取り除かれます。
...ect#hash により行われます。
@param other_arrays 0個以上の配列を指定します。
//emlist[例][ruby]{
["a", "b", "c"].union([ "c", "d", "a" ]) #=> ["a", "b", "c", "d"]
["a"].union(["e", "b"], ["a", "c", "b"]) #=> ["a", "e", "b", "c"]
["a"].union # => ["a"]
//}
@see Array#|... -
Fiddle
:: Importer # union(signature) -> Class (18213.0) -
C の共用体型に対応する Ruby のクラスを構築して返します。
...して返します。
共用体型を Ruby 上で定義する方法は Fiddle::Importer#struct と
ほぼ同様です。C における
typedef union epoll_data
{
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
は、Ruby上では
require 'fiddle/import'
m......unsigned long long")
EPollData = union(["void *ptr",
"int fd",
"uint32_t u32",
"uint64_t u64",
])
end
となります。
返されるクラスは Fiddle::CUnion を継承しています。
1.9.x で... -
Set
# union(enum) -> Set (15201.0) -
和集合、すなわち、2 つの集合の少なくともどちらか一方に属するすべての 要素からなる新しい集合を作ります。
和集合、すなわち、2 つの集合の少なくともどちらか一方に属するすべての
要素からなる新しい集合を作ります。
@param enum each メソッドが定義されたオブジェクトを指定します。
@raise ArgumentError 引数 enum に each メソッドが定義されていない場合に
発生します。
//emlist[][ruby]{
require 'set'
p Set[10, 20, 30] + Set[10, 20, 40]
# => #<Set: {10, 20, 30, 40}>
//} -
NEWS for Ruby 3
. 0 . 0 (300.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...mlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}
* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It can be used like a rightward assignment.
17260
* `in......> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}
* Find-pattern is added. [EXPERIMENTAL]
16828
//emlist{
case ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre, String => x, String => y, *post]
p pr......* GC-ing JIT-ed code is executed in a background thread.
* Reduce the number of locks between Ruby and JIT threads.
== Static analysis
=== RBS
* RBS is a new language for type definition of Ruby programs. It allows writing types of classes and modules with advanced types including union typ... -
Array
# |(other) -> Array (106.0) -
集合の和演算です。両方の配列にいずれかに含まれる要素を全て含む新し い配列を返します。重複する要素は取り除かれます。
...暗黙の型変換を試みます。
@raise TypeError 引数に配列以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
[1, 1, 4, 2, 3] | [5, 4, 5] #=> [1, 4, 2, 3, 5]
//}
@see Array#&
@see Array#union... -
Fiddle
:: Importer # sizeof(t) -> Integer (106.0) -
C における sizeof(t) の値を返します。
...ます。
Fiddle::Importer#struct で定義した
構造体クラスを渡すと、その構造体のサイズを返します。
Fiddle::Importer#union で定義した共用体クラスも同様です。
t がクラスの場合、t が to_ptr というインスタンスメソッドを持ってい... -
Fiddle
:: Importer # typealias(new , orig) -> () (106.0) -
extern や struct で利用する型の別名を定義します。
...extern や struct で利用する型の別名を定義します。
@param new 別名(文字列)
@param orig 別名を付けたい型の名前(文字列)
@see Fiddle::Importer#extern, Fiddle::Importer#sizeof,
Fiddle::Importer#struct, Fiddle::Importer#union... -
Object
# to _ regexp -> Regexp (106.0) -
オブジェクトの Regexp への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...ての場面で代置可能であるような、
* 正規表現そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_regexp
/[\d]+/
end
end
it = Foo.new
p Regexp.union(/^at/, it) #=> /(?-mix:^at)|(?-mix:[\d]+)/
//}... -
WIN32OLE
_ TYPE # ole _ type -> String | nil (106.0) -
selfの型の種類(TYPEKIND)を取得します。
...ションサーバ(4)
: Class
コンポーネントクラス(InterfaceやDispatchの実装)(5)
: Alias
他の型の別名(6)
: Union
共用体(7)
: Max
型の種類を示す列挙体の終端マーカ(8)
MaxはTYPEKINDの終端マーカなので意味を持ちませ... -
Set
# +(enum) -> Set (101.0) -
和集合、すなわち、2 つの集合の少なくともどちらか一方に属するすべての 要素からなる新しい集合を作ります。
和集合、すなわち、2 つの集合の少なくともどちらか一方に属するすべての
要素からなる新しい集合を作ります。
@param enum each メソッドが定義されたオブジェクトを指定します。
@raise ArgumentError 引数 enum に each メソッドが定義されていない場合に
発生します。
//emlist[][ruby]{
require 'set'
p Set[10, 20, 30] + Set[10, 20, 40]
# => #<Set: {10, 20, 30, 40}>
//}