Sha256: fb4a7592b2f00f4aefc40a3e04f961417b21409327c89e2b0661a200c7040dbf

Contents?: true

Size: 456 Bytes

Versions: 1

Compression:

Stored size: 456 Bytes

Contents

# frozen_string_literal: true

module WeatherLink
  class HashWrapper < SimpleDelegator
    attr_reader :data

    def initialize(data)
      @data = data
      super
    end

    private

    def method_missing(symbol, *args)
      return data.fetch(symbol.to_s) if data.include?(symbol.to_s)

      super
    end

    def respond_to_missing?(symbol, include_private = false)
      return true if data.include?(symbol.to_s)

      super
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weatherlink-0.1.0 lib/weatherlink/hash_wrapper.rb