Sha256: 4a2bea90205ea0aae08f4b0342c6f704b0c8ca4b017c73086fca1919402f674f

Contents?: true

Size: 920 Bytes

Versions: 7

Compression:

Stored size: 920 Bytes

Contents

require File.join(File.dirname(__FILE__), "rmpd/config")
require File.join(File.dirname(__FILE__), "rmpd/command")
require File.join(File.dirname(__FILE__), "rmpd/commands")
require File.join(File.dirname(__FILE__), "rmpd/io")
require File.join(File.dirname(__FILE__), "rmpd/connection")
require File.join(File.dirname(__FILE__), "rmpd/response")

module Rmpd
  ACK_RE = /^ACK \[(\d+)@(\d+)\] \{([^}]*)\} (.*)$/
  OK_RE = /^OK.*$/
  LIST_OK_RE = /^list_OK.*$/
  PROTOCOL_RE = /^OK MPD (\d+)\.(\d+)\.(\d+)$/
  END_RE = Regexp.union(ACK_RE, OK_RE, PROTOCOL_RE)

  class MpdError < StandardError ; end

  class MpdConnRefusedError < MpdError ; end

  class MpdAckError < MpdError
    def initialize(regex_match)
      @error, @command_list_num, @current_command, @message = regex_match.values_at(1..-1)
    end

    def to_s
      "ACK [#{@error}@#{@command_list_num}] {#{@current_command}} #{@message}"
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rmpd-1.1.9 lib/rmpd.rb
rmpd-1.1.8 lib/rmpd.rb
rmpd-1.1.7 lib/rmpd.rb
rmpd-1.1.6 lib/rmpd.rb
rmpd-1.1.5 lib/rmpd.rb
rmpd-1.1.4 lib/rmpd.rb
rmpd-1.1.3 lib/rmpd.rb