moumar-wmainfo-rb 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/wmainfo.rb +8 -3
  2. metadata +3 -2
@@ -20,7 +20,7 @@
20
20
  # Improved character encoding handling thanks to
21
21
  # Guillaume Pierronnet <guillaume.pierronnet @nospam@ gmail.com>
22
22
 
23
- require 'iconv'
23
+ require 'iconv' if RUBY_VERSION.to_f < 1.9
24
24
 
25
25
  # raised when errors occur parsing wma header
26
26
  class WmaInfoError < StandardError
@@ -39,7 +39,8 @@ class WmaInfo
39
39
  @stream = {}
40
40
  @file = file
41
41
  @debug = opts[:debug]
42
- @ic = Iconv.new(opts[:encoding] || "ASCII", "UTF-16LE")
42
+ @encoding = opts[:encoding] || "ASCII"
43
+ @ic = Iconv.new(@encoding, "UTF-16LE") if RUBY_VERSION.to_f < 1.9
43
44
  parse_wma_header
44
45
  end
45
46
 
@@ -310,7 +311,11 @@ class WmaInfo
310
311
 
311
312
  # UTF16LE -> ASCII
312
313
  def decode_binary_string(data)
313
- @ic.iconv(data).strip
314
+ if RUBY_VERSION.to_f < 1.9
315
+ @ic.iconv(data).strip
316
+ else
317
+ data.to_s.encode(@encoding, "UTF-16LE")
318
+ end
314
319
  end
315
320
 
316
321
  def read_and_increment_offset(size)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moumar-wmainfo-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: '0.8'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-02 00:00:00.000000000Z
12
+ date: 2012-12-08 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: ! ":: wmainfo-rb ::\nAuthor: Darren Kirby\nmailto:bulliver@badcomputer.org\nLicense:
15
15
  Ruby\n\n = Quick API docs =\n\n == Initializing ==\n\n require 'wmainfo'\n foo
@@ -62,3 +62,4 @@ signing_key:
62
62
  specification_version: 3
63
63
  summary: Pure Ruby lib for accessing info/tags from wma/wmv files
64
64
  test_files: []
65
+ has_rdoc: true