Skip to content

Commit

Permalink
Merge pull request #1012 from agraul/fix-coercion-error
Browse files Browse the repository at this point in the history
Fix binary coercion for single binaries
  • Loading branch information
agraul committed May 25, 2021
2 parents b34ed02 + 8060ad0 commit 3759968
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/obs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ class InvalidSearchTerm < StandardError; end
# Binary.quality => [String]
class Binary < Hashie::Mash
include Hashie::Extensions::Mash::SymbolizeKeys

def self.coerce(binary)
binary = Array(binary)
binary.map { |bin| Binary.new(bin) }
if binary.instance_of?(Hashie::Array)
binary.map do |bin|
Binary.new(bin)
end
else
[Binary.new(binary.to_h)]
end
end
end

Expand Down

0 comments on commit 3759968

Please sign in to comment.