Class: Card::Format::JsonFormat

Inherits:
DataFormat show all
Defined in:
lib/card/format/json_format.rb

Overview

card format class for json (JavaScript Object Notation) views

Instance Method Summary collapse

Instance Method Details

#expand_stubs(content) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/card/format/json_format.rb', line 13

def expand_stubs content
  case content
  when Hash
    content.each { |k, v| content[k] = expand_stubs v }
  when Array
    content.map { |item| expand_stubs item }
  else
    super
  end
end

#mime_typeObject



9
10
11
# File 'lib/card/format/json_format.rb', line 9

def mime_type
  "text/json"
end