implement iqdb wrapper
This commit is contained in:
19
app/logical/iqdb/responses/response_202.rb
Normal file
19
app/logical/iqdb/responses/response_202.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
module Iqdb
|
||||
module Responses
|
||||
class Response_202 < Base
|
||||
attr_reader :original_id, :stddev, :dupes
|
||||
|
||||
def initialize(response_string)
|
||||
response_string =~ /^(\d+)=([0-9.]+)/
|
||||
@original_id = $1
|
||||
@stddev = $2
|
||||
|
||||
@dupes = response_string.scan(/(\d+):([0-9.]+)/).map {|x| [x[0].to_i(16), x[1].to_f]}
|
||||
end
|
||||
|
||||
def original_post_id
|
||||
original_id.to_i(16)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user