Sha256: 8757e6c7c550c26a90309dc0533317f616a1f5bd4af05f38651049b30ae0494c

Contents?: true

Size: 629 Bytes

Versions: 7

Compression:

Stored size: 629 Bytes

Contents

module Qcmd
  class Context
    attr_accessor :machine, :workspace, :workspace_connected

    def reset
      disconnect_machine
      disconnect_workspace
    end

    def disconnect_machine
      self.machine = nil
    end

    def disconnect_workspace
      self.workspace = nil
      self.workspace_connected = false
    end

    def machine_connected?
      !machine.nil?
    end

    def workspace_connected?
      !!workspace_connected
    end

    def connection_state
      if !machine_connected?
        :none
      elsif !workspace_connected?
        :machine
      else
        :workspace
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
qcmd-0.1.6 lib/qcmd/context.rb
qcmd-0.1.5 lib/qcmd/context.rb
qcmd-0.1.4 lib/qcmd/context.rb
qcmd-0.1.3 lib/qcmd/context.rb
qcmd-0.1.2 lib/qcmd/context.rb
qcmd-0.1.1 lib/qcmd/context.rb
qcmd-0.1.0 lib/qcmd/context.rb