module Camunda::VariableSerialization

The VariableSerialization module adds information to variables so Camunda can parse them. It adds types annotations and serializes hashes and array to JSON. Camunda engine cannot search on snake_case variables so it changes variable names to camelCase. @see Camunda::ProcessDefinition

Public Instance Methods

camelcase_keys(hash) click to toggle source
# File lib/camunda/variable_serialization.rb, line 54
def camelcase_keys(hash)
  hash.deep_transform_keys { |key| key.to_s.camelcase(:lower) }
end
serialize_variables(variables) click to toggle source

Wrapper for class level method

# File lib/camunda/variable_serialization.rb, line 10
def serialize_variables(variables)
  self.class.serialize_variables(variables)
end
transform_json(json) click to toggle source

Transforms keys of a JSON like object (Array,Hash) from snake_case to CamelCase @param json [Array,Hash] @return [Hash] returns hash with camelCase keys

# File lib/camunda/variable_serialization.rb, line 43
def transform_json(json)
  case json
  when Array
    json.map { |element| transform_json(element) }
  when Hash
    camelcase_keys(json)
  else
    json
  end
end