Module: SoarSc::Web::Views::JSON
- Defined in:
- lib/soar_sc_views/json.rb
Class Method Summary collapse
Class Method Details
.error ⇒ Object
16 17 18 19 |
# File 'lib/soar_sc_views/json.rb', line 16 def self.error body = ex. [500, {"Content-Type" => "application/json"}, [::JSON.generate(body)]] end |
.is_json?(data) ⇒ Boolean
21 22 23 24 25 26 27 28 |
# File 'lib/soar_sc_views/json.rb', line 21 def self.is_json?(data) begin ::JSON.parse(data) return true rescue => ex return false end end |
.not_found ⇒ Object
12 13 14 |
# File 'lib/soar_sc_views/json.rb', line 12 def self.not_found [404, {}, []] end |