Sha256: 1014d6ab58bffeb649c8de1266e8c0afba080e0f33c6e7559675bcfc87c97db2

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

require "forwardable"

module Jess
  # A Hash-like wrapper around the extension attributes that facilitates easy
  # key/value access.
  class ExtensionAttributes < Resource
    extend Forwardable
    def_delegators :@values, :[], :fetch, :key?, :keys, :size, :length, :to_h

    def initialize(json)
      super
      @values = json.each_with_object({}) do |attr, hash|
        hash[attr.name] = attr.value
      end
      @values.freeze
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jess-0.1.0 lib/jess/extension_attributes.rb