るりまサーチ

最速Rubyリファレンスマニュアル検索!
87件ヒット [1-87件を表示] (0.119秒)
トップページ > クエリ:I[x] > クエリ:union[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

ライブラリ

クラス

モジュール

キーワード

検索結果

Regexp.union(*pattern) -> Regexp (24297.0)

引数として与えた pattern を選択 | で連結し、Regexp として返します。 結果の Regexp は与えた pattern のどれかにマッチする場合にマッチするものになります。

...emlist[][ruby]{
p Regexp.union(/a/, /b/, /c/) # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/
//}

引数を一つだけ与える場合は、Array を与えても Regexp を生成します。
つまり、以下のように書くことができます。

//emlist[][ruby]{
arr = [/a/, /b/, /c/]
p Regexp.union(ar...
...r) # => /(?-mix:a)|(?-mix: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() # => /(?!)/
//}

結果の...

Array#union(*other_arrays) -> Array (24219.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 (24213.0)

C の共用体型に対応する Ruby のクラスを構築して返します。

...Fiddle::Importer#struct と
ほぼ同様です。C における
typedef union epoll_data
{
void *ptr;
i
nt fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
は、Ruby上では
require 'fiddle/import'

module M
extend Fiddle::Importer
dlload "libc.so.6"
typealia...
...s("uint32_t", "unsigned int")
typealias("uint64_t", "unsigned long long")

EPollData = union(["void *ptr",
"int fd",
"uint32_t u32",
"uint64_t u64",
])
end
となります。

返されるクラス...
...は Fiddle::CUnion を継承しています。

1.9.x ではこのメソッドで返されるクラスは正しく動作しません。
2.0以降では修正されています。

@param signature 共用体の各要素を文字列で表現したものの配列...

Set#union(enum) -> Set (18201.0)

和集合、すなわち、2 つの集合の少なくともどちらか一方に属するすべての 要素からなる新しい集合を作ります。

...num each メソッドが定義されたオブジェクトを指定します。
@raise ArgumentError 引数 enum に each メソッドが定義されていない場合に
発生します。

//emlist[][ruby]{
require 'set'
p Set[10, 20, 30] + Set[10, 20, 40]
# => #<Set: {10, 20, 30, 40}>
//}...

Fiddle::CUnion (12006.0)

C の共用体を表すクラスです。

...C の共用体を表すクラスです。

このクラスは直接は使わず、Fiddle::Importer#union を用いて
このクラスを継承したクラスを生成し、それを利用します。

Fiddle::CStruct と同様の構造をしています。詳しくはそちらを見てください...

絞り込み条件を変える

Fiddle::Importer#sizeof(t) -> Integer (6106.0)

C における sizeof(t) の値を返します。

...C における sizeof(t) の値を返します。

t が文字列の場合、その文字列が表す C の型の size が返されます。
例えば、sizeof("char") は 1 を返します。
sizeof("char*") は環境によって 4 や 8 といった値を返します。

Fiddle::Importer#struct...
...イズを返します。
Fiddle::Importer#union で定義した共用体クラスも同様です。

t がクラスの場合、t が to_ptr というインスタンスメソッドを持っている
ならば t.size を返します。

それ以外の場合は Pointer[t].size を返します。

@par...
...対象
@raise Fiddle::DLError t として文字列を渡し、それが表している型を Fiddle が知らなかった
場合に発生します

例:

require 'fiddle/import'

module M
extend Fiddle::Importer
Timeval = struct(["long tv_sec", "long tv_usec"])
p sizeof("cha...

Fiddle::Importer#typealias(new, orig) -> () (6106.0)

extern や struct で利用する型の別名を定義します。

...extern や struct で利用する型の別名を定義します。

@param new 別名(文字列)
@param orig 別名を付けたい型の名前(文字列)
@see Fiddle::Importer#extern, Fiddle::Importer#sizeof,
Fiddle::Importer#struct, Fiddle::Importer#union...

WIN32OLE_TYPE#ole_type -> String | nil (3106.0)

selfの型の種類(TYPEKIND)を取得します。

...selfの型の種類(TYPEKIND)を取得します。

@return selfの型の種類を文字列で返します。情報が取得できない場合はnilを返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'Application')
p tobj.ole_type # => Class

ole_typeには...
...持)(2)
: Interface
COMのインターフェイス(メソッド定義の集合)(3)
: Dispatch
OLEオートメーションサーバ(4)
: Class
コンポーネントクラス(InterfaceやDispatchの実装)(5)
: Alias
他の型の別名(6)
: Union
共用体(7...
...
: Max
型の種類を示す列挙体の終端マーカ(8)

MaxはTYPEKINDの終端マーカなので意味を持ちません。

@see WIN32OLE_TYPE#typekind...

NEWS for Ruby 3.0.0 (12.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting...
...single rest argument and no keywords.
16166

//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leadin...
...* 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...