Class: Vayacondios::StandardContentsHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/vayacondios/legacy_switch.rb

Overview

Are we operating on JSON Hashes (Vayacondios) or on JSON arrays (Vayacondios Legacy)? These classes determine which to use.

Instance Method Summary collapse

Instance Method Details

#extract_contents(document) ⇒ Object



7
# File 'lib/vayacondios/legacy_switch.rb', line 7

def extract_contents(document) document['contents'] end

#proper_request(document) ⇒ Object



8
9
10
11
# File 'lib/vayacondios/legacy_switch.rb', line 8

def proper_request(document)
  result = document.is_a?(Hash) and document.fetch('_json', {}).is_a?(Hash)
  result
end

#wrap_contents(contents) ⇒ Object



6
# File 'lib/vayacondios/legacy_switch.rb', line 6

def wrap_contents(contents) {contents: contents} end