Method: Origami::Stream.guess_type

Defined in:
lib/origami/stream.rb

.guess_type(hash) ⇒ Object

:nodoc:



178
179
180
181
182
183
184
185
186
187
188
# File 'lib/origami/stream.rb', line 178

def self.guess_type(hash) #:nodoc:
    best_type = self

    @@type_signatures.each_pair do |klass, keys|
        next unless klass < best_type

        best_type = klass if keys.all? { |k,v| hash[k] == v }
    end

    best_type
end