Class: ALSA::Aconnect::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/alsa/aconnect/client.rb

Constant Summary collapse

DIRECTIONS =
[:input, :output].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, direction) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/alsa/aconnect/client.rb', line 10

def initialize(text, direction)
  raise ArgumentError, "invalid direction #{direction.inspect}" unless DIRECTIONS.include?(direction)

  @direction = direction

  data = Parser.parse_client(text)
  @id = data[:id]
  @name = data[:name]
  @type = data[:type]
  @card = data[:card]
  @pid = data[:pid]
  @ports = data[:ports].map do |port_text|
    Port.new(port_text, self)
  end
end

Instance Attribute Details

#cardObject (readonly)

Returns the value of attribute card.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def card
  @card
end

#directionObject (readonly)

Returns the value of attribute direction.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def direction
  @direction
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def name
  @name
end

#pidObject (readonly)

Returns the value of attribute pid.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def pid
  @pid
end

#portsObject (readonly)

Returns the value of attribute ports.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def ports
  @ports
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/alsa/aconnect/client.rb', line 8

def type
  @type
end