Module: Micro::Struct::Features::Options

Defined in:
lib/micro/struct/features.rb

Class Method Summary collapse

Class Method Details

.from(names:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/micro/struct/features.rb', line 7

def self.from(names:)
  options = names.each_with_object({}) { |name, memo| memo[name] = true }

  {
    to_ary: options.fetch(:to_ary, false),
    to_hash: options.fetch(:to_hash, false),
    to_proc: options.fetch(:to_proc, false),
    readonly: options.fetch(:readonly, false),
    instance_copy: options.fetch(:instance_copy, false),
    exposed_features: options.fetch(:exposed_features, false)
  }
end