Class: Dumon::Ui

Inherits:
Object
  • Object
show all
Defined in:
lib/dumon/ui.rb

Overview

This class represents Dumon’s user interface.

Direct Known Subclasses

GtkUi

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUi

Constructor.



16
17
18
19
# File 'lib/dumon/ui.rb', line 16

def initialize
  @omanager = new_omanager
  Dumon::logger.debug "Used output manager: #{omanager.class.name}"
end

Instance Attribute Details

#omanagerObject (readonly)

Output manager used to manipulate the output.



12
13
14
# File 'lib/dumon/ui.rb', line 12

def omanager
  @omanager
end

Instance Method Details

#aboutObject

Provides information about the app.

Raises:

  • (NotImplementedError)


49
50
51
# File 'lib/dumon/ui.rb', line 49

def about
  raise NotImplementedError, 'this should be overridden by concrete sub-class'
end

#new_omanager(with = Dumon::XrandrManager) ⇒ Object

Factory method to create a new object of output manager.<p/> Can be used as Dependency Injection (DI) entry point: you can reopen Dumon:Ui and redefine ‘new_omanager’ if you implement a new output manager. <pre> class Dumon::Ui

def new_omanager; Dumon::XyManager.new; end

end </pre>



30
31
32
# File 'lib/dumon/ui.rb', line 30

def new_omanager(with=Dumon::XrandrManager)
  with.new
end

#quitObject

Quits the application.

Raises:

  • (NotImplementedError)


43
44
45
# File 'lib/dumon/ui.rb', line 43

def quit
  raise NotImplementedError, 'this should be overridden by concrete sub-class'
end

#renderObject

Renders the UI. Abstract method to be overridden by concrete sub-class.

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/dumon/ui.rb', line 37

def render
  raise NotImplementedError, 'this should be overridden by concrete sub-class'
end