Sha256: 0e22a9c94e03d080ebddb05d23b8ddca29d6b72ea7a2138d305add1b688c5820

Contents?: true

Size: 844 Bytes

Versions: 1

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

module AssetCloud
  class Metadata
    attr_accessor :exist, :size, :created_at, :updated_at, :value_hash, :checksum

    def new?
      !exist
    end

    def exist?
      exist
    end

    # rubocop:disable Metrics/ParameterLists
    def initialize(exist, size = nil, created_at = nil, updated_at = nil, value_hash = nil, checksum = nil)
      self.exist = exist
      self.size = size
      self.created_at = created_at
      self.updated_at = updated_at
      self.value_hash = value_hash
      self.checksum = checksum
    end
    # rubocop:enable Metrics/ParameterLists

    class << self
      def existing
        new(true)
      end

      def non_existing
        new(false)
      end
    end

    def inspect
      "#<#{self.class.name}: exist:#{exist} size:#{size.inspect} bytes>"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asset_cloud-2.7.2 lib/asset_cloud/metadata.rb