Class: Ffprober::Parsers::JsonParser

Inherits:
Object
  • Object
show all
Defined in:
lib/ffprober/parsers/json.rb

Instance Method Summary collapse

Constructor Details

#initialize(json_to_parse) ⇒ JsonParser

Returns a new instance of JsonParser.

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'lib/ffprober/parsers/json.rb', line 7

def initialize(json_to_parse)
  raise ArgumentError, 'No JSON input data' if json_to_parse.nil?

  @json_to_parse = json_to_parse
end

Instance Method Details

#jsonObject



13
14
15
# File 'lib/ffprober/parsers/json.rb', line 13

def json
  @json ||= JSON.parse(@json_to_parse, symbolize_names: true)
end