class HashMath::Matrix::KeyValuePair

A hash-like structure that allows you to gradually build up keys.

Constants

Pair

Attributes

key[R]
value[R]

Public Class Methods

new(key) click to toggle source
# File lib/hash_math/matrix/key_value_pair.rb, line 18
def initialize(key)
  @key    = key
  @value  = Set.new

  freeze
end

Public Instance Methods

add(val) click to toggle source
# File lib/hash_math/matrix/key_value_pair.rb, line 29
def add(val)
  tap { value << val }
end
add_each(vals) click to toggle source
# File lib/hash_math/matrix/key_value_pair.rb, line 25
def add_each(vals)
  tap { vals.each { |val| add(val) } }
end
pairs() click to toggle source
# File lib/hash_math/matrix/key_value_pair.rb, line 33
def pairs
  value.map { |value| Pair.new(key, value) }
end