Sha256: e3ecf94aab0dbf695929e79dbfbb6f9d51e4b58d97d1806ec3cf867122ea177a

Contents?: true

Size: 279 Bytes

Versions: 1

Compression:

Stored size: 279 Bytes

Contents

module Upholsterer
  class Base
    def to_hash
      Hash[public_methods(false).collect do |field|
        [field, public_send(field)]
      end]
    end

    def to_json(*args)
      to_hash.to_json(*args)
    end

    alias :to_h :to_hash
    alias :as_json :to_json
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
upholsterer-0.4.0 lib/upholsterer/json_presenter.rb