Sha256: 46f5418b7a9964a24db03c6b607ec347aad4fd932df381f3c2f2a2df1d7b775e
Contents?: true
Size: 967 Bytes
Versions: 1
Compression:
Stored size: 967 Bytes
Contents
# frozen_string_literal: true module DerivationEndpoint class Config REQUIRED_ATTRIBUTES = [:host, :prefix, :encoder, :decoder].freeze def self.valid?(config) Validation.check_object_class(config, [self]) REQUIRED_ATTRIBUTES.all? { |attribute| !!config.public_send(attribute) } end attr_reader :host, :prefix, :encoder, :decoder def initialize @host = nil @prefix = nil @encoder = nil @decoder = nil end def valid? self.class.valid?(self) end def host=(value) Validation.check_object_class(value, [String]) @host = value end def prefix=(value) Validation.check_object_class(value, [String]) @prefix = value end def encoder=(value) Validation.check_object_class(value, [Proc]) @encoder = value end def decoder=(value) Validation.check_object_class(value, [Proc]) @decoder = value end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
derivation_endpoint-0.1.0 | lib/derivation_endpoint/config.rb |