Sha256: 958199b1e209bd84cf798fc899b21bbb33a5469b9f4042850e28daf00a07bbf8

Contents?: true

Size: 283 Bytes

Versions: 17

Compression:

Stored size: 283 Bytes

Contents

# frozen_string_literal: true
module ONEAccess
  module Serializable
    def represented_by(representer_class)
      @representer_class = representer_class
    end

    def from_json(json)
      obj = new
      @representer_class.new(obj).from_json(json)
      obj
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
oneaccess-0.4.4 lib/oneaccess/serializable.rb
oneaccess-0.4.3 lib/oneaccess/serializable.rb
oneaccess-0.4.2 lib/oneaccess/serializable.rb
oneaccess-0.4.1 lib/oneaccess/serializable.rb
oneaccess-0.4.0 lib/oneaccess/serializable.rb
oneaccess-0.3.0 lib/oneaccess/serializable.rb
oneaccess-0.2.0 lib/oneaccess/serializable.rb
oneaccess-0.1.9 lib/oneaccess/serializable.rb
oneaccess-0.1.8 lib/oneaccess/serializable.rb
oneaccess-0.1.7 lib/oneaccess/serializable.rb
oneaccess-0.1.6 lib/oneaccess/serializable.rb
oneaccess-0.1.5 lib/oneaccess/serializable.rb
oneaccess-0.1.4 lib/oneaccess/serializable.rb
oneaccess-0.1.3 lib/oneaccess/serializable.rb
oneaccess-0.1.2 lib/oneaccess/serializable.rb
oneaccess-0.1.1 lib/oneaccess/serializable.rb
oneaccess-0.1.0 lib/oneaccess/serializable.rb