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:



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

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)


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

def current_info
  @current_info
end

#target_specSwpins::Specs::Base (readonly)

Returns:



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

def target_spec
  @target_spec
end

Instance Method Details

#current_versionString?

Returns:

  • (String, nil)


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

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

#outdated?Boolean

Returns:

  • (Boolean)


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

def outdated?
  !uptodate?
end

#target_versionString?

Returns:

  • (String, nil)


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

def target_version
  target_spec.version
end

#uptodate?Boolean

Returns:

  • (Boolean)


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

def uptodate?
  @uptodate
end