class FDK::ParsedInput

ParsedInput stores raw input and can parse it as JSON (add extra formats as required)

Attributes

raw[R]

Public Class Methods

new(raw_input:) click to toggle source
# File lib/fdk/support_classes.rb, line 25
def initialize(raw_input:)
  @raw = raw_input
end

Public Instance Methods

as_json() click to toggle source
# File lib/fdk/support_classes.rb, line 29
def as_json
  @json ||= JSON.parse(raw)
rescue JSON::ParserError
  @json = false
end
parsed() click to toggle source
# File lib/fdk/support_classes.rb, line 35
def parsed
  as_json || raw
end