Sha256: db330e0399abdc10e497329591e6b44e8dab0ff436a51c2e63c9d474f6f82354

Contents?: true

Size: 325 Bytes

Versions: 2

Compression:

Stored size: 325 Bytes

Contents

# frozen_string_literal: true

module AsJson
  class ScopedJsonMapper
    def initialize(klass)
      @klass = klass
    end

    def method_missing(name, *args, **kargs)
      @klass.json_with "with_#{name}": kargs.merge(args.map { |key| [key, true] }.to_h)
    end

    def respond_to_missing?
      true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
as_json-0.1.1 lib/as_json/scoped_json_mapper.rb
as_json-0.1.0 lib/as_json/scoped_json_mapper.rb