Class: Linguistics::Latin::Verb::LatinVerb::Mutators::Irregular::Deserializer

Inherits:
Object
  • Object
show all
Defined in:
lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verb) ⇒ Deserializer

Returns a new instance of Deserializer.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb', line 10

def initialize(verb)
  @verb = verb
  json_string = Linguistics::Latin::Verb.const_get(symbolize_original_string)
  raise "Found a JSON string with an absurdly small length!" if json_string.length <= 10
  @revivified_data_structure = JSON.parse( json_string )
rescue JSON::ParserError => e
  puts "We were unable to parse JSON for #{@verb.original_string} [o:#{o}] [o_sym:#{o_upcase_and_symbolic}].  Please verify your syntax."
  raise e
rescue NameError => e
  puts "We were unable to find a definition for #{@verb.original_string}"
  raise e
rescue => e
  warn "#{@verb.original_string} was identified as irregular but did not have a definition provided."
  raise e
end

Instance Attribute Details

#revivified_data_structureObject (readonly)

Returns the value of attribute revivified_data_structure.



8
9
10
# File 'lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb', line 8

def revivified_data_structure
  @revivified_data_structure
end