Sha256: 3b8d325f5ca3a46636d688ca4675b3fd1ed7ea2b66dc3eb38dc18d67172fa27e
Contents?: true
Size: 542 Bytes
Versions: 3
Compression:
Stored size: 542 Bytes
Contents
module ServiceContract AbstractType = Struct.new(:definition) do def name raise NotImplementedError, "need to implement `name`" end def subtype nil end def fields [] end def valid_type?(value) valid_ruby_types.any?{|type| value.is_a?(type) } end def valid_value?(value) if valid_values.empty? true else valid_values.include?(value) end end def valid_values [] end def valid_ruby_types [Object] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
service_contract-0.6.0 | lib/service_contract/abstract_type.rb |
service_contract-0.5.1 | lib/service_contract/abstract_type.rb |
service_contract-0.5.0 | lib/service_contract/abstract_type.rb |