Class: Avm::EacWebappBase0::FileFormats::Json

Inherits:
Avm::EacGenericBase0::FileFormats::Base
  • Object
show all
Defined in:
lib/avm/eac_webapp_base0/file_formats/json.rb

Constant Summary collapse

VALID_BASENAMES =
%w[*.json].freeze
VALID_TYPES =
[].freeze

Instance Method Summary collapse

Instance Method Details

#json_file?(file) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'lib/avm/eac_webapp_base0/file_formats/json.rb', line 10

def json_file?(file)
  ::JSON.parse(::File.read(file))
  true
rescue JSON::ParserError
  false
end

#string_apply(string) ⇒ String

Parameters:

  • string (String)

Returns:

  • (String)


19
20
21
# File 'lib/avm/eac_webapp_base0/file_formats/json.rb', line 19

def string_apply(string)
  super(::JSON.pretty_generate(::JSON.parse(string)))
end