class Streamer::FactProviders::HashProvider

HashProvider implements the Finder Provider interface

Attributes

data[R]

Public Class Methods

new(data = nil) click to toggle source
# File lib/streamer/fact_providers/hash_provider.rb, line 6
def initialize(data = nil)
  @data = data || {}
end

Public Instance Methods

find(key) click to toggle source
# File lib/streamer/fact_providers/hash_provider.rb, line 10
def find(key)
  string_keys = key.split('.')
  sym_keys = key.split('.').map(&:to_sym)
  data.dig(*string_keys) || data.dig(*sym_keys)
end