lib/jess/extension_attributes.rb in jess-0.3.0 vs lib/jess/extension_attributes.rb in jess-0.4.0
- old
+ new
@@ -1,16 +1,17 @@
require "forwardable"
module Jess
# A Hash-like wrapper around the extension attributes that facilitates easy
# key/value access.
- class ExtensionAttributes
+ 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
+ hash[attr["name"]] = attr["value"]
end
@values.freeze
end
# Explicitly delegate instead of using def_delegators in order to be