Class: MatrixDBus::Matrix2DBus

Inherits:
DBus::Object
  • Object
show all
Defined in:
lib/matrix_dbus/dbus.rb

Overview

DBus

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Matrix2DBus

Returns a new instance of Matrix2DBus.



6
7
8
9
# File 'lib/matrix_dbus/dbus.rb', line 6

def initialize(*args)
  @matrix = MatrixDBus::Matrix.new
  super
end

Instance Attribute Details

#matrixObject (readonly)

Returns the value of attribute matrix.



4
5
6
# File 'lib/matrix_dbus/dbus.rb', line 4

def matrix
  @matrix
end

Class Method Details

.return(info) ⇒ Object



23
24
25
26
27
# File 'lib/matrix_dbus/dbus.rb', line 23

def self.return(info)
  return ['{}'] if info.nil?
  return ['{}'] if info.empty?
  [JSON.pretty_generate(info)]
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/matrix_dbus/dbus.rb', line 11

def run
  Thread.new do
    begin
      @matrix.run
    rescue RestClient::Exception => e
      puts e
      puts e.response.body
      retry
    end
  end
end