Class: ConfCtl::MachineStatus::SwpinState

Inherits:
Object
  • Object
show all
Defined in:
lib/confctl/machine_status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_spec, current_info) ⇒ SwpinState

Returns a new instance of SwpinState.

Parameters:



14
15
16
17
18
19
20
21
22
23
# File 'lib/confctl/machine_status.rb', line 14

def initialize(target_spec, current_info)
  @target_spec = target_spec
  @current_info = current_info
  @uptodate =
    if current_info
      target_spec.check_info(current_info)
    else
      false
    end
end

Instance Attribute Details

#current_infoHash? (readonly)

Returns:

  • (Hash, nil)


10
11
12
# File 'lib/confctl/machine_status.rb', line 10

def current_info
  @current_info
end

#target_specSwpins::Specs::Base (readonly)

Returns:



7
8
9
# File 'lib/confctl/machine_status.rb', line 7

def target_spec
  @target_spec
end

Instance Method Details

#current_versionString?

Returns:

  • (String, nil)


39
40
41
# File 'lib/confctl/machine_status.rb', line 39

def current_version
  target_spec.version_info(current_info) || 'unknown'
end

#outdated?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/confctl/machine_status.rb', line 29

def outdated?
  !uptodate?
end

#target_versionString?

Returns:

  • (String, nil)


34
35
36
# File 'lib/confctl/machine_status.rb', line 34

def target_version
  target_spec.version
end

#uptodate?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/confctl/machine_status.rb', line 25

def uptodate?
  @uptodate
end