Class JCON::Types::RecordType
In: lib/jcon/conformance.rb
lib/jcon/types.rb
Parent: Type

Methods

contains?   new   to_s  

Attributes

properties  [R] 

Public Class methods

[Source]

    # File lib/jcon/types.rb, line 54
54:       def initialize(properties);
55:         @properties = properties
56:       end

Public Instance methods

[Source]

    # File lib/jcon/conformance.rb, line 43
43:       def contains?(value)
44:         return false unless value.is_a?(Hash)
45:         value.each do |k, v|
46:           type = properties["#{k}".intern]
47:           return false unless type
48:           return false unless type.contains?(v)
49:         end
50:         properties.each do |k, _|
51:           return false unless value.include?(k) or value.include?(k.to_s)
52:         end
53:         true
54:       end

[Source]

    # File lib/jcon/types.rb, line 58
58:       def to_s; "{#{properties.map { |k,v| "#{k}: #{v}"}.join(', ')}}"; end

[Validate]