Sha256: b9a567a8d3fdfa6b9acb88b4cb0d5ecd5bad3348e3b62fa3e6713c5d31fd43fe

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 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/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

3 entries across 3 versions & 1 rubygems

Version Path
rmpd-1.1.2 lib/rmpd.rb
rmpd-1.1.1 lib/rmpd.rb
rmpd-1.1.0 lib/rmpd.rb