Sha256: 097a0dfa0335e675f252afeab5b20fdf4f73aeb2d49803381d72920ea3a129a6

Contents?: true

Size: 692 Bytes

Versions: 9

Compression:

Stored size: 692 Bytes

Contents

module ActiveGraph
  class AttributeSet < ActiveModel::AttributeSet
    def initialize(attr_hash, attr_list)
      hashmap = ActiveGraph::LazyAttributeHash.new(attr_hash, attr_list)
      super(hashmap)
    end

    def method_missing(name, *args, **kwargs, &block)
      if defined?(name)
        attributes.send(:materialize).send(name, *args, **kwargs, &block)
      else
        super
      end
    end

    def respond_to_missing?(method, *)
      attributes.send(:materialize).respond_to?(method) || super
    end

    def keys
      attributes.send(:materialize).keys
    end

    def ==(other)
      other.is_a?(ActiveGraph::AttributeSet) ? super : to_hash == other
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activegraph-12.0.0.beta.5 lib/active_graph/attribute_set.rb
activegraph-12.0.0.beta.4 lib/active_graph/attribute_set.rb
activegraph-11.5.0.beta.3 lib/active_graph/attribute_set.rb
activegraph-12.0.0.beta.3 lib/active_graph/attribute_set.rb
activegraph-12.0.0.beta.2 lib/active_graph/attribute_set.rb
activegraph-11.5.0.beta.2 lib/active_graph/attribute_set.rb
activegraph-12.0.0.beta.1 lib/active_graph/attribute_set.rb
activegraph-11.5.0.beta.1 lib/active_graph/attribute_set.rb
activegraph-11.5.0.alpha.1 lib/active_graph/attribute_set.rb