Class: Pastenum::JSON
- Inherits:
-
Object
- Object
- Pastenum::JSON
- Defined in:
- lib/pastenum/json.rb
Instance Method Summary collapse
-
#initialize(dork, sites) ⇒ JSON
constructor
A new instance of JSON.
- #to_file ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(dork, sites) ⇒ JSON
Returns a new instance of JSON.
4 5 6 7 8 9 |
# File 'lib/pastenum/json.rb', line 4 def initialize(dork, sites) @data = [{:search => dork}] sites.each do |site| @data << {site.vendor => site.results} end end |
Instance Method Details
#to_file ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/pastenum/json.rb', line 15 def to_file file = File.open('report.json', 'w') file.write(data.to_json) file.close return @data end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/pastenum/json.rb', line 11 def to_s return @data end |