Sha256: 6588e5dabad9698494ac3769ca0e845434e205424c3d7b8e45867c9a6f20b8bb

Contents?: true

Size: 761 Bytes

Versions: 34

Compression:

Stored size: 761 Bytes

Contents

# frozen_string_literal: true

require 'active_model/attribute_set'

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

34 entries across 34 versions & 1 rubygems

Version Path
activegraph-11.4.0 lib/active_graph/attribute_set.rb
activegraph-11.3.1 lib/active_graph/attribute_set.rb
activegraph-11.3.0 lib/active_graph/attribute_set.rb
activegraph-11.2.0 lib/active_graph/attribute_set.rb
activegraph-11.1.0 lib/active_graph/attribute_set.rb
activegraph-11.1.0.beta.1 lib/active_graph/attribute_set.rb
activegraph-11.1.0.alpha.4 lib/active_graph/attribute_set.rb
activegraph-11.1.0.alpha.3 lib/active_graph/attribute_set.rb
activegraph-11.1.0.alpha.2 lib/active_graph/attribute_set.rb
activegraph-11.1.0.alpha.1 lib/active_graph/attribute_set.rb
activegraph-10.2.0.beta.1 lib/active_graph/attribute_set.rb
activegraph-11.0.2-java lib/active_graph/attribute_set.rb
activegraph-10.1.1 lib/active_graph/attribute_set.rb
activegraph-11.0.1-java lib/active_graph/attribute_set.rb
activegraph-11.0.0-java lib/active_graph/attribute_set.rb
activegraph-10.1.0 lib/active_graph/attribute_set.rb
activegraph-11.0.0.beta.4-java lib/active_graph/attribute_set.rb
activegraph-10.0.2 lib/active_graph/attribute_set.rb
activegraph-11.0.0.beta.3-java lib/active_graph/attribute_set.rb
activegraph-11.0.0.beta.2-java lib/active_graph/attribute_set.rb