Class: FSR::App::Bridge

Inherits:
Application show all
Defined in:
lib/fsr/app/bridge.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Application

#app_name, #sendmsg, #to_s

Constructor Details

#initialize(target, opts = {}) ⇒ Bridge

Returns a new instance of Bridge.



8
9
10
11
12
# File 'lib/fsr/app/bridge.rb', line 8

def initialize(target, opts = {})
  # These are options that will precede the target address
  @target = target
  @options = opts || {}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/fsr/app/bridge.rb', line 6

def options
  @options
end

Class Method Details

.execute(target, opts = {}) ⇒ Object



26
27
28
# File 'lib/fsr/app/bridge.rb', line 26

def self.execute(target, opts = {})
  self.new(target, opts).raw
end

Instance Method Details

#argumentsObject



14
15
16
# File 'lib/fsr/app/bridge.rb', line 14

def arguments
  [@target]
end

#modifiersObject



18
19
20
# File 'lib/fsr/app/bridge.rb', line 18

def modifiers
  @options.map { |k,v| "%s=%s" % [k, v] }.join(",")
end

#rawObject



22
23
24
# File 'lib/fsr/app/bridge.rb', line 22

def raw
  "%s({%s}%s)" % [app_name, modifiers, arguments.join(" ")]
end