Class: FSR::App::Fifo

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Application

#app_name, #raw, #sendmsg, #to_s

Constructor Details

#initialize(name, direction = nil, options = nil) ⇒ Fifo

Returns a new instance of Fifo.



17
18
19
20
21
22
23
24
# File 'lib/fsr/app/fifo.rb', line 17

def initialize(name, direction = nil, options = nil)
  # These are options that will precede the target address
  @name = name
  @direction = direction || "in"
  raise "Direction must be 'in' or 'out'" unless @direction.match(/^(?:in|out)$/)
  @options = options || {}
  raise "options must be a hash" unless @options.kind_of?(Hash)
end

Instance Attribute Details

#directionObject

Returns the value of attribute direction.



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

def direction
  @direction
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/fsr/app/fifo.rb', line 7

def options
  @options
end

Class Method Details

.<<(name) ⇒ Object



9
10
11
# File 'lib/fsr/app/fifo.rb', line 9

def self.<<(name)
  new(name)
end

.>>(name) ⇒ Object



13
14
15
# File 'lib/fsr/app/fifo.rb', line 13

def self.>>(name)
  new(name, "out", :wait => true)
end

Instance Method Details

#argumentsObject



26
27
28
29
30
31
32
# File 'lib/fsr/app/fifo.rb', line 26

def arguments
  @args = [@name, @direction]
  if @direction == "out"
    @args << (options[:wait] ? "wait" : "nowait")
  end
  @args
end