Class: FakeAPI::JSONWriter

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

Class Method Summary collapse

Class Method Details

.remove_brackets_for_hash_argument(str) ⇒ Object



21
22
23
# File 'lib/fakeapi/json_writer.rb', line 21

def self.remove_brackets_for_hash_argument(str)
  str[1..-2]
end

.write(json) ⇒ Object



15
16
17
18
19
# File 'lib/fakeapi/json_writer.rb', line 15

def self.write(json)
  inner = json.inspect
  inner = remove_brackets_for_hash_argument(inner) if json.is_a?(Hash)
  "JSON(#{inner})"
end