Class: KnapsackPro::RegularAllocator::Split

Inherits:
Object
  • Object
show all
Defined in:
lib/knapsack_pro/regular_allocator.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, response) ⇒ Split

Returns a new instance of Split.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
# File 'lib/knapsack_pro/regular_allocator.rb', line 6

def initialize(connection, response)
  @connection = connection
  @response = response

  raise ArgumentError.new(connection.response) if connection.errors?
end

Instance Method Details

#connection_failed?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/knapsack_pro/regular_allocator.rb', line 20

def connection_failed?
  !connection.success?
end

#exists?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
# File 'lib/knapsack_pro/regular_allocator.rb', line 13

def exists?
  raise "Connection failed. Please report this as a bug: #{KnapsackPro::Urls::SUPPORT}" if connection_failed?
  return false if connection.api_code == KnapsackPro::Client::API::V1::BuildDistributions::TEST_SUITE_SPLIT_CACHE_MISS_CODE

  true
end

#test_filesObject



24
25
26
# File 'lib/knapsack_pro/regular_allocator.rb', line 24

def test_files
  response.fetch('test_files')
end