Sha256: 52b55493cb929d9517492fceec4815f5a5651b4c5e23203d23599f685a2bf585

Contents?: true

Size: 481 Bytes

Versions: 6

Compression:

Stored size: 481 Bytes

Contents

# frozen_string_literal: true

require 'travis/client'

module Travis
  module Client
    class WeakEntity < Entity
      include NotLoadable

      def self.weak?
        true
      end

      def self.id_field
        raise 'weak entities do not have id fields'
      end

      def self.id?(object)
        object.nil?
      end

      def self.cast_id(object)
        return object if id? object

        raise 'weak entities do not have id fields'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
travis-1.14.0 lib/travis/client/weak_entity.rb
travis-1.13.3 lib/travis/client/weak_entity.rb
travis-1.13.2 lib/travis/client/weak_entity.rb
travis-1.13.1 lib/travis/client/weak_entity.rb
travis-1.13.0 lib/travis/client/weak_entity.rb
travis-1.12.0 lib/travis/client/weak_entity.rb