lib/bencode/encode/hash.rb in bencode-0.5.0 vs lib/bencode/encode/hash.rb in bencode-0.5.1
- old
+ new
@@ -8,12 +8,8 @@
# be in lexicographical order.
def bencode
pairs = sort.map{|key, val| [key.to_str.bencode, val.bencode] }
"d#{pairs.join('')}e"
rescue NoMethodError => error
- if error.name == :to_str
- raise BEncode::EncodeError, "dictionary keys must be strings"
- else
- raise
- end
+ raise BEncode::EncodeError, "dictionary keys must be strings"
end
end