Sha256: dcd100bf7fa74c465aa8346aeb8f9ba2f20b931cb381f8f5d584d962ccfb1212

Contents?: true

Size: 672 Bytes

Versions: 6

Compression:

Stored size: 672 Bytes

Contents

# frozen_string_literal: true

module ALSA
  module Aconnect
    class Client
      DIRECTIONS = [:input, :output].freeze

      attr_reader :id, :name, :type, :card, :pid, :ports, :direction

      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alsa_aconnect-0.1.5 lib/alsa/aconnect/client.rb
alsa_aconnect-0.1.4 lib/alsa/aconnect/client.rb
alsa_aconnect-0.1.3 lib/alsa/aconnect/client.rb
alsa_aconnect-0.1.2 lib/alsa/aconnect/client.rb
alsa_aconnect-0.1.1 lib/alsa/aconnect/client.rb
alsa_aconnect-0.1.0 lib/alsa/aconnect/client.rb