Module: Lucerna::Gates::Runtime

Defined in:
lib/lucerna/gates/runtime.rb

Constant Summary collapse

SCHEMA_VERSION =

The newest runtime document shape this engine understands. A document with a higher schemaVersion means the SDK needs an upgrade — keep the current runtime instead of half-reading it.

1

Class Method Summary collapse

Class Method Details

.acceptable?(document) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
# File 'lib/lucerna/gates/runtime.rb', line 13

def acceptable?(document)
  return false unless document.is_a?(Hash)

  version = document["schemaVersion"]
  return false unless version.is_a?(Numeric) && version <= SCHEMA_VERSION

  %w[kills flags experiments audiences].all? { |key| document[key].is_a?(Hash) }
end