Sha256: b881a5a32e74fce3d2d81797acfc22e050a7b4529708915b441b461b05698e31

Contents?: true

Size: 1.14 KB

Versions: 39

Compression:

Stored size: 1.14 KB

Contents

module ActiveGraph
  module Shared
    extend ActiveSupport::Concern
    extend ActiveModel::Naming

    include ActiveModel::Conversion
    begin
    include ActiveModel::Serializers::Xml
    rescue NameError; end # rubocop:disable Lint/HandleExceptions
    include ActiveModel::Serializers::JSON

    module ClassMethods
      # This should be used everywhere.  Should make it easy
      # to support a driver-per-model system
      def neo4j_query(*args)
        ActiveGraph::Base.query(*args)
      end

      def new_query
        ActiveGraph::Base.new_query
      end
    end

    included do
      self.include_root_in_json = ActiveGraph::Config.include_root_in_json
      @_declared_properties ||= ActiveGraph::Shared::DeclaredProperties.new(self)

      def self.i18n_scope
        :neo4j
      end

      def self.inherited(other)
        attributes.each_pair do |k, v|
          other.inherit_property k.to_sym, v.clone, declared_properties[k].options
        end
        super
      end
    end

    def declared_properties
      self.class.declared_properties
    end

    def neo4j_query(*args)
      self.class.neo4j_query(*args)
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
activegraph-12.0.0.beta.5 lib/active_graph/shared.rb
activegraph-12.0.0.beta.4 lib/active_graph/shared.rb
activegraph-11.5.0.beta.3 lib/active_graph/shared.rb
activegraph-12.0.0.beta.3 lib/active_graph/shared.rb
activegraph-12.0.0.beta.2 lib/active_graph/shared.rb
activegraph-11.5.0.beta.2 lib/active_graph/shared.rb
activegraph-12.0.0.beta.1 lib/active_graph/shared.rb
activegraph-11.5.0.beta.1 lib/active_graph/shared.rb
activegraph-11.5.0.alpha.1 lib/active_graph/shared.rb
activegraph-11.4.0 lib/active_graph/shared.rb
activegraph-11.3.1 lib/active_graph/shared.rb
activegraph-11.3.0 lib/active_graph/shared.rb
activegraph-11.2.0 lib/active_graph/shared.rb
activegraph-11.1.0 lib/active_graph/shared.rb
activegraph-11.1.0.beta.1 lib/active_graph/shared.rb
activegraph-11.1.0.alpha.4 lib/active_graph/shared.rb
activegraph-11.1.0.alpha.3 lib/active_graph/shared.rb
activegraph-11.1.0.alpha.2 lib/active_graph/shared.rb
activegraph-11.1.0.alpha.1 lib/active_graph/shared.rb
activegraph-10.2.0.beta.1 lib/active_graph/shared.rb