lib/audio_monster/monster.rb in audio_monster-1.1.0 vs lib/audio_monster/monster.rb in audio_monster-1.1.1
- old
+ new
@@ -830,11 +830,11 @@
mpeg_layer = info.layer.to_i
add_error(:layer, "must be mpeg layer #{layer}, but audio layer is #{mpeg_layer}") unless mpeg_layer == layer
end
if options[:channel_mode]
- cm_list = options[:channel_mode].to_a
+ cm_list = Array(options[:channel_mode])
add_error(:channel_mode, "channel mode must be one of (#{cm_list.to_sentence})") unless cm_list.include?(info.channel_mode)
end
if options[:channels]
channels = options[:channels].to_i
@@ -845,11 +845,11 @@
# only certain rates are valid for different layer/versions, but don't add that right now
if options[:sample_rate]
sample_rate = 44100
op = ">="
mpeg_sample_rate = info.samplerate.to_i
- if options[:sample_rate].match(' ')
+ if options[:sample_rate].to_s.match(' ')
op, sample_rate = options[:sample_rate].split(' ')
sample_rate = sample_rate.to_i
op = valid_operator(op)
else
sample_rate = options[:sample_rate].to_i
@@ -859,11 +859,11 @@
if options[:bit_rate]
bit_rate = 128
op = ">="
mpeg_bit_rate = info.bitrate.to_i
- if options[:bit_rate].match(' ')
+ if options[:bit_rate].to_s.match(' ')
op, bit_rate = options[:bit_rate].split(' ')
bit_rate = bit_rate.to_i
op = valid_operator(op)
else
bit_rate = options[:bit_rate].to_i
@@ -875,10 +875,10 @@
per_channel_bit_rate = 128
op = ">="
mpeg_channels = "Single Channel" == info.channel_mode ? 1 : 2
mpeg_per_channel_bit_rate = info.bitrate.to_i / mpeg_channels
- if options[:per_channel_bit_rate].match(' ')
+ if options[:per_channel_bit_rate].to_s.match(' ')
op, per_channel_bit_rate = options[:per_channel_bit_rate].split(' ')
per_channel_bit_rate = per_channel_bit_rate.to_i
op = valid_operator(op)
else
per_channel_bit_rate = options[:per_channel_bit_rate].to_i