Class: Remocon::JsonNormalizer
Instance Attribute Summary
Attributes inherited from Normalizer
#content
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Normalizer
#initialize, #process
Class Method Details
.respond_symbol ⇒ Object
5
6
7
|
# File 'lib/remocon/normalizer/json_normalizer.rb', line 5
def self.respond_symbol
Remocon::Type::JSON
end
|
Instance Method Details
#normalize ⇒ Object
16
17
18
|
# File 'lib/remocon/normalizer/json_normalizer.rb', line 16
def normalize
@json
end
|
#validate ⇒ Object
9
10
11
12
13
14
|
# File 'lib/remocon/normalizer/json_normalizer.rb', line 9
def validate
str_content = @content.is_a?(Hash) ? @content.to_json : @content.to_s
@json = JSON.parse(str_content).to_json
rescue JSON::ParserError => e
raise ValidationError, e.message
end
|