Class: Chef::ServerAPIVersions

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/chef/server_api_versions.rb

Instance Method Summary collapse

Instance Method Details

#max_server_versionObject


37
38
39
40
41
42
43
44
# File 'lib/chef/server_api_versions.rb', line 37

def max_server_version
  # If we're working with a pre-api-versioning server, always claim to be zero
  if @versions.nil?
    unversioned? ? 0 : nil
  else
    Integer(@versions["max_version"])
  end
end

#min_server_versionObject


28
29
30
31
32
33
34
35
# File 'lib/chef/server_api_versions.rb', line 28

def min_server_version
  # If we're working with a pre-api-versioning server, always claim to be zero
  if @versions.nil?
    unversioned? ? 0 : nil
  else
    Integer(@versions["min_version"])
  end
end

#reset!Object


54
55
56
57
# File 'lib/chef/server_api_versions.rb', line 54

def reset!
  @versions = nil
  @unversioned = false
end

#set_versions(versions) ⇒ Object


24
25
26
# File 'lib/chef/server_api_versions.rb', line 24

def set_versions(versions)
  @versions ||= versions
end

#unversioned!Object


46
47
48
# File 'lib/chef/server_api_versions.rb', line 46

def unversioned!
  @unversioned = true
end

#unversioned?Boolean


50
51
52
# File 'lib/chef/server_api_versions.rb', line 50

def unversioned?
  @unversioned
end