Sha256: d0f1446138fdc38dfd1f7f4011f46a5db4cb230fc4241971a36da21a40ead3db

Contents?: true

Size: 314 Bytes

Versions: 3

Compression:

Stored size: 314 Bytes

Contents

# frozen_string_literal: true

require 'digest/sha2'
require 'sequel'

module Ditty
  module Base
    def for_json
      values
    end

    def display_id
      self[:slug] || self[:guid] || self[:id]
    end

    def etag
      Digest::SHA2.hexdigest values.to_json
    end

    alias for_csv for_json
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ditty-0.11.1 lib/ditty/models/base.rb
ditty-0.10.2 lib/ditty/models/base.rb
ditty-0.10.1 lib/ditty/models/base.rb