Module: GembirdBackend

Defined in:
lib/gembird-backend.rb,
lib/gembird-backend/retry.rb,
lib/gembird-backend/parser.rb,
lib/gembird-backend/command.rb,
lib/gembird-backend/scanner.rb,
lib/gembird-backend/version.rb

Defined Under Namespace

Classes: Command, ExecutionError, Parser, Retry, Scanner

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.commandObject



20
21
22
# File 'lib/gembird-backend.rb', line 20

def command
  @command ||= GembirdBackend::Command.new
end

.devicesObject



30
31
32
# File 'lib/gembird-backend.rb', line 30

def devices
  try { parse command.devices }
end

.loggerObject



11
12
13
# File 'lib/gembird-backend.rb', line 11

def logger
  @logger ||= Logger.new(open('/dev/null', "w+"))
end

.off!(socket = 'all', options = {}) ⇒ Object



40
41
42
# File 'lib/gembird-backend.rb', line 40

def off! socket='all', options={}
  try { parse command.off! socket, options }
end

.on!(socket = 'all', options = {}) ⇒ Object



35
36
37
# File 'lib/gembird-backend.rb', line 35

def on! socket='all', options={}
  try { parse command.on! socket, options }
end

.parse(result) ⇒ Object



15
16
17
18
# File 'lib/gembird-backend.rb', line 15

def parse result
  @parser ||= GembirdBackend::Parser.new
  @parser.parse result
end

.status(socket = 'all', options = {}) ⇒ Object



50
51
52
# File 'lib/gembird-backend.rb', line 50

def status socket='all', options={}
  try { parse command.status socket, options }
end

.toggle!(socket = 'all', options = {}) ⇒ Object



45
46
47
# File 'lib/gembird-backend.rb', line 45

def toggle! socket='all', options={}
  try { parse command.toggle! socket, options }
end

.try(&block) ⇒ Object



24
25
26
27
# File 'lib/gembird-backend.rb', line 24

def try &block
  @retry ||= GembirdBackend::Retry.new
  @retry.try &block
end