Sha256: 21f549621eace24df500dae66a9d8aea25f4aa88d64b8f585851f2416caa9e19
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module JsonStatham class Parser attr_reader :name, :block, :reader, :observer def self.call(name, &block) new(name, &block).call end def initialize(name, &block) Validation.check_object_class(name, [String]) @name = name @block = block end def call @reader = JsonStatham::Requests::Reader.call(self) @observer = JsonStatham::Requests::Observer.call(self) result = JsonStatham::Result.call(self) store_current_schema result end def store_current_schema return unless JsonStatham.config.store_schema? JsonStatham::Requests::Writer.call(self) end def schema observer&.data end def stored_schema return unless reader? reader["schema"] end def previous_duration return unless reader? reader["duration"] end def reader? !!reader end def current_schema JsonStatham::Schema.call(schema) end def stored_schema? !!stored_schema end def valid? !stored_schema? || (stored_schema == current_schema) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
json_statham-0.1.3 | lib/json_statham/parser.rb |
json_statham-0.1.2 | lib/json_statham/parser.rb |