moc 2.5.0.5 → 2.5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -208,11 +208,11 @@ class Controller
208
208
  send_command :ping
209
209
 
210
210
  read_event == :pong
211
- rescue
211
+ rescue Exception
212
212
  false
213
213
  end
214
214
 
215
- def quit
215
+ def quit!
216
216
  send_command :quit
217
217
 
218
218
  self
@@ -58,6 +58,10 @@ class Event < Symbol
58
58
 
59
59
  super
60
60
  end
61
+
62
+ def inspect
63
+ "#<#{self.class.name}: #{to_s}#{" #{data.inspect}" if data}>"
64
+ end
61
65
  end
62
66
 
63
67
  end; end
@@ -16,18 +16,18 @@ class String < ::String
16
16
  def self.read (io)
17
17
  length = Integer.read(io)
18
18
  string = io.read(length)
19
-
20
- new(if string.force_encoding('UTF-8').valid_encoding?
21
- string
22
- elsif string.force_encoding('ISO-8859-1').valid_encoding?
23
- string.encode!('UTF-8')
24
- else
25
- string.encode!('UTF-8', invalid: :replace, undef: :replace)
26
- end)
19
+
20
+ %w[UTF-8 ISO-8859-1].each {|encoding|
21
+ if string.force_encoding(encoding).valid_encoding?
22
+ return new(string)
23
+ end
24
+ }
25
+
26
+ new(string.force_encoding('BINARY'))
27
27
  end
28
28
 
29
29
  def pack
30
- Integer.new(bytesize).pack << encode('UTF-8').force_encoding('BINARY')
30
+ (Integer.new(bytesize).pack << self).force_encoding('BINARY')
31
31
  end
32
32
  end
33
33
 
@@ -25,7 +25,7 @@ class Symbol
25
25
  @internal = value.respond_to?(:to_i) ? self.class.codes.key(value.to_i) : value.to_sym.upcase
26
26
 
27
27
  unless @internal && self.class.codes.member?(@internal)
28
- raise ArgumentError, "invalid symbol #{value}"
28
+ raise ArgumentError, "invalid symbol #{value} for #{self.class.name}"
29
29
  end
30
30
  end
31
31
 
@@ -10,6 +10,6 @@
10
10
 
11
11
  module Moc
12
12
  def self.version
13
- '2.5.0.5'
13
+ '2.5.0.6'
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0.5
4
+ version: 2.5.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,17 +9,17 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-24 00:00:00.000000000 Z
12
+ date: 2012-10-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: meh@paranoici.org
16
16
  executables:
17
- - mocp.rb
17
+ - moc-remote.rb
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
21
  - README.md
22
- - bin/mocp.rb
22
+ - bin/moc-remote.rb
23
23
  - lib/moc.rb
24
24
  - lib/moc/controller.rb
25
25
  - lib/moc/controller/player.rb