Sha256: 370650c8555d06aafaf04cd6880eea17f0fd1fdb1de47cf2a6dba050a862e5c3
Contents?: true
Size: 653 Bytes
Versions: 2
Compression:
Stored size: 653 Bytes
Contents
# frozen_string_literal: true require "key_vortex/constraint" require "key_vortex/limitation" class KeyVortex class Field attr_reader :name, :limitation def initialize(name, type, *constraints_array, **constraints_hash) @name = name @limitation = KeyVortex::Limitation.new(type) @limitation.add_constraint(*constraints_array) @limitation.add_constraint(*constraints_hash.map do |attribute, value| KeyVortex::Constraint.build(attribute, value) end) end def prohibited_by?(adapter) limitation = adapter.limitation_for(self) limitation&.prohibits?(self.limitation) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
key-vortex-0.1.4 | lib/key_vortex/field.rb |
key-vortex-0.1.3 | lib/key_vortex/field.rb |