Class Hash
In: multiset/libmultiset.rb
multiset/libmultimap.rb
Parent: Object

Methods

Public Instance methods

selfを多重連想配列に変換し、その結果を返します。 新しく生成される多重連想配列においてキーに割り当てられる値は、 selfに含まれる1要素のみです。

Generates multiset from self. In generated multiset, only one value is associated with a key (value in self).

selfを多重連想配列に変換し、その結果を返します。 新しく生成される多重連想配列においてキーに割り当てられる値は、 selfにおけるキーの値をMultiset.parseによって多重集合に 変換したものとなります。

(例)キー:aには:x:yが1個ずつ、 キー:bには:xが2個割り当てられた多重連想配列

{:a => [:x, :y], :b => [:x, :x]}.to_multiset

Generates multiset from self. In generated multiset, values associated with a key are defined by the result of Multiset.parse(values_in_self) .

(example) Key :a is associated with values one :x and one :y, and key :b is associated with values two :x

{:a => [:x, :y], :b => [:x, :x]}.to_multiset

selfを多重集合に変換し、その結果を返します。 キーを要素、キーに対応する値をその要素の要素数とします。

(例){:a => 4, :b => 2}.to_multiset # :aを4個、:bを2個含む多重集合

Generates multiset from self. Keys are treated as elements, and values are number of elements in the multiset. For example,

{:a => 4, :b => 2}.to_multiset # Multiset with four :a‘s and two :b‘s

[Validate]