Sha256: 0d331db47c654be2819e92576018d7537b3bbd955df279c7d0c7bb9392bc807d
Contents?: true
Size: 788 Bytes
Versions: 3
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true module Micro::Struct module Features DISABLED = { to_ary: false, to_hash: false, to_proc: false, readonly: false, instance_copy: false }.freeze Check = ->(to_ary:, to_hash:, to_proc:, readonly:, instance_copy:) do { to_ary: to_ary, to_hash: to_hash, to_proc: to_proc, readonly: readonly, instance_copy: instance_copy } end NormalizeFeatureNames = ->(values) do NormalizeNames::AsSymbols.(values, context: 'feature') end def self.require(names) to_enable = NormalizeFeatureNames[names].each_with_object({}) { |name, memo| memo[name] = true } Check.(**DISABLED.merge(to_enable)) end end private_constant :Features end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
u-struct-0.10.0 | lib/micro/struct/features.rb |
u-struct-0.9.0 | lib/micro/struct/features.rb |
u-struct-0.8.0 | lib/micro/struct/features.rb |