Class: BrewSON

Inherits:
Brewser::Engine show all
Defined in:
lib/brewser/engines/brewson.rb

Class Method Summary collapse

Class Method Details

.acceptable?(q) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/brewser/engines/brewson.rb', line 5

def acceptable?(q)
  return q.valid_json?
end

.deserialize(string_or_io) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/brewser/engines/brewson.rb', line 9

def deserialize(string_or_io)
   begin
     JSON.parse(string_or_io)
  rescue
    raise Error, "BrewSON engine encountered an issue and can not continue"
   end
end

.serialize(brewser_model) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/brewser/engines/brewson.rb', line 17

def serialize(brewser_model)
   begin
     JSON.generate(brewser_model)
  rescue
    raise Error, "BrewSON engine encountered an issue and can not continue"
   end
end