Class: MeshChat::Instance
- Inherits:
-
Object
- Object
- MeshChat::Instance
- Defined in:
- lib/meshchat/instance.rb
Instance Attribute Summary collapse
-
#client_name ⇒ Object
Returns the value of attribute client_name.
-
#client_version ⇒ Object
Returns the value of attribute client_version.
-
#display ⇒ Object
Returns the value of attribute display.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Instance
constructor
A new instance of Instance.
- #start_input_device(klass) ⇒ Object
- #start_ui(klass, on_display_start) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Instance
Returns a new instance of Instance.
21 22 23 24 |
# File 'lib/meshchat/instance.rb', line 21 def initialize( = {}) self.client_name = [:client_name] || MeshChat::NAME self.client_version = [:client_version] || MeshChat::VERSION end |
Instance Attribute Details
#client_name ⇒ Object
Returns the value of attribute client_name.
3 4 5 |
# File 'lib/meshchat/instance.rb', line 3 def client_name @client_name end |
#client_version ⇒ Object
Returns the value of attribute client_version.
3 4 5 |
# File 'lib/meshchat/instance.rb', line 3 def client_version @client_version end |
#display ⇒ Object
Returns the value of attribute display.
3 4 5 |
# File 'lib/meshchat/instance.rb', line 3 def display @display end |
Class Method Details
.instance ⇒ Object
16 17 18 |
# File 'lib/meshchat/instance.rb', line 16 def instance @instance end |
.start(options) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/meshchat/instance.rb', line 9 def start() # calling instance to get things going @instance = new() @instance.start_input_device([:input]) @instance.start_ui([:display], [:on_display_start]) end |
Instance Method Details
#start_input_device(klass) ⇒ Object
35 36 37 38 |
# File 'lib/meshchat/instance.rb', line 35 def start_input_device(klass) # The CLI is a singleton that takes a method of input MeshChat::CLI.create(klass) end |
#start_ui(klass, on_display_start) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/meshchat/instance.rb', line 28 def start_ui(klass, on_display_start) self.display = Display::Manager.new(klass) display.start do on_display_start.call if on_display_start end end |