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.0.0.beta.1-java lib/active_graph/attribute_set.rb
activegraph-10.0.1 lib/active_graph/attribute_set.rb
activegraph-10.0.0 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.11 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.10 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.9 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.8 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.7 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.6 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.5 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.4 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.3 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.2 lib/active_graph/attribute_set.rb
activegraph-10.0.0.pre.beta.1 lib/active_graph/attribute_set.rb