koleksiuk/dry-elastic_model

View on GitHub
lib/dry/elastic_model/base.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require "dry-struct"

module Dry
  module ElasticModel
    class Base < Dry::Struct
      extend Schema
      extend Attributes

      def as_json(opts = {})
        if attributes.respond_to? :as_json
          attributes.as_json(opts)
        else
          attributes
        end
      end
    end
  end
end