るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

Regexp.union(*pattern) -> Regexp (24303.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/e, /b/) # => /(?-mix:a)|(?-mix:b)/e
//}

@
param pattern | で連結したい正規表現を指定します


//emlist[例][ruby]{
# オプションは合成されない
p Regexp.union(/foo/i, /bar/x, /hoge/m) # => /(?i-mx:foo)|(?x-mi:bar)|(?m-ix:hoge)/

#...

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

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

...新しい集合を作ります。

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

//emlist[][ruby]{
require 'set'
p Set[10, 20, 30] + Set[10,...

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

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

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

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

絞り込み条件を変える

Fiddle::Importer#sizeof(t) -> Integer (6118.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 を返します。

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

例:

require 'fiddle/import'

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

WIN32OLE_TYPE#ole_type -> String | nil (3118.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 (24.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...
...RIMENTAL]
16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no longer frozen when
`# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@M...
...* 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...