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

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

Constant Summary collapse

With =
->(bool, names) { names.each_with_object({}) { |name, memo| memo[name] = bool } }
DISABLED =
With.(false, method(:check).parameters.map(&:last)).freeze

Class Method Summary collapse

Class Method Details

.check(to_ary:, to_hash:, to_proc:, readonly:, instance_copy:, exposed_features:) ⇒ Object



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

def self.check(to_ary:, to_hash:, to_proc:, readonly:, instance_copy:, exposed_features:)
  { to_ary: to_ary,
    to_hash: to_hash,
    to_proc: to_proc, 
    readonly: readonly,
    instance_copy: instance_copy,
    exposed_features: exposed_features }
end

.from_names(values) ⇒ Object



23
24
25
26
27
# File 'lib/micro/struct/features.rb', line 23

def self.from_names(values)
  enabled = With.(true, values)

  check(**DISABLED.merge(enabled))
end