Sha256: 85b6b32009fcb8882c7406884f2a1a0a2d624c613d93aff2ae4d871de9acc6b6
Contents?: true
Size: 798 Bytes
Versions: 1
Compression:
Stored size: 798 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 ValidateFeatureNames = ->(values) do Validate::Names.(values, label: 'feature') end def self.require(names) features_to_enable = ValidateFeatureNames[names].each_with_object({}) { |name, memo| memo[name] = true } Check.(**DISABLED.merge(features_to_enable)) end end private_constant :Features end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
u-struct-0.6.0 | lib/micro/struct/features.rb |