Module: Musa::Datasets::PackedV

Includes:
AbsI
Defined in:
lib/musa-dsl/datasets/packed-v.rb

Constant Summary

Constants included from E

E::NaturalKeys

Instance Method Summary collapse

Methods included from E

#valid?, #validate!

Instance Method Details

#to_V(mapper) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/musa-dsl/datasets/packed-v.rb', line 8

def to_V(mapper)
  case mapper
  when Hash
    mapper.collect { |key, default| self[key] || default }.extend(V)
  when Array
    mapper.collect { |key| self[key] }.extend(V)
  else
    raise ArgumentError, "Expected Hash or Array as mapper but got a #{mapper.class.name}"
  end
end