class ActiveLoader::JsonLoader

Attributes

raw_content[R]

Public Class Methods

new(raw_content) click to toggle source
# File lib/active_loader/json_loader.rb, line 8
def initialize(raw_content)
  @raw_content = raw_content.to_s
end

Public Instance Methods

call() click to toggle source
# File lib/active_loader/json_loader.rb, line 12
def call
  safe_load
end

Private Instance Methods

safe_load() click to toggle source
# File lib/active_loader/json_loader.rb, line 20
def safe_load
  JSON.parse(raw_content)
rescue JSON::ParserError => exception
  raise ActiveLoader::ParseError.new(exception.message, loader_name: self.class.to_s)
end