Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/isporn.rb

Instance Method Summary collapse

Instance Method Details

#is_porn?Boolean

Returns:

  • (Boolean)


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/isporn.rb', line 56

def is_porn?
  test_url = self
  if (test_url =~ /\A#{URI::regexp}\z/)==0 and test_url.length<4096
    res = Isporn.exadeep_api_rest_urls [self]  
  else
    temp_fn = "_temp.jpeg"
    image =  MiniMagick::Image.open(self)
    image.resize "270x270"
    image.format "jpeg"
    image.write temp_fn
    res = Isporn.exadeep_api_rest_post temp_fn
    File.delete temp_fn
  end    

  j=JSON.parse(res)
  j["results"].first["scores"].first["label"]
end

#is_porn_jsonObject



74
75
76
# File 'lib/isporn.rb', line 74

def is_porn_json
  Isporn.exadeep_api_rest_post self
end

#isporn?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/isporn.rb', line 52

def isporn?
  is_porn?
end