Class: OpenStruct

Inherits:
Object
  • Object
show all
Defined in:
lib/doi_extractor/old_ruby_patch.rb

Overview

Previous to 2.0 ruby doesn’t define the index methods on OpenStruct. These are used in the IpumsClient when parsing json into OpenStruct objects.

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



7
8
9
# File 'lib/doi_extractor/old_ruby_patch.rb', line 7

def [](key)
  self.send(key.to_sym)
end

#[]=(key, value) ⇒ Object



11
12
13
# File 'lib/doi_extractor/old_ruby_patch.rb', line 11

def []=(key, value)
  self.send("#{key}=".to_sym, value)
end