Sha256: 632e7591cf9b1747b79ab9f8b2bdff72fe640b7802bfad0990f829ab077a79b7

Contents?: true

Size: 1.16 KB

Versions: 43

Compression:

Stored size: 1.16 KB

Contents

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

    include ActiveModel::Conversion
    include ActiveModel::Serializers::Xml
    include ActiveModel::Serializers::JSON

    module ClassMethods
      attr_writer :neo4j_session_name

      def neo4j_session_name(name)
        ActiveSupport::Deprecation.warn 'neo4j_session_name is deprecated and may be removed from future releases, use neo4j_session_name= instead.', caller

        @neo4j_session_name = name
      end

      def neo4j_session
        if @neo4j_session_name
          Neo4j::Session.named(@neo4j_session_name) ||
            fail("#{self.name} is configured to use a neo4j session named #{@neo4j_session_name}, but no such session is registered with Neo4j::Session")
        else
          Neo4j::Session.current!
        end
      end
    end

    included do
      self.include_root_in_json = Neo4j::Config.include_root_in_json
      @_declared_property_manager ||= Neo4j::Shared::DeclaredPropertyManager.new(self)

      def self.i18n_scope
        :neo4j
      end
    end

    def declared_property_manager
      self.class.declared_property_manager
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
neo4j-5.2.15 lib/neo4j/shared.rb
neo4j-5.2.14 lib/neo4j/shared.rb
neo4j-5.2.13 lib/neo4j/shared.rb
neo4j-5.2.12 lib/neo4j/shared.rb
neo4j-5.2.11 lib/neo4j/shared.rb
neo4j-5.2.10 lib/neo4j/shared.rb
neo4j-5.2.9 lib/neo4j/shared.rb
neo4j-5.2.8 lib/neo4j/shared.rb
neo4j-5.2.7 lib/neo4j/shared.rb
neo4j-5.2.6 lib/neo4j/shared.rb
neo4j-5.2.5 lib/neo4j/shared.rb
neo4j-5.2.3 lib/neo4j/shared.rb
neo4j-5.2.2 lib/neo4j/shared.rb
neo4j-5.2.1 lib/neo4j/shared.rb
neo4j-5.2.0 lib/neo4j/shared.rb
neo4j-5.1.5 lib/neo4j/shared.rb
neo4j-5.1.4 lib/neo4j/shared.rb
neo4j-5.1.3 lib/neo4j/shared.rb
neo4j-5.1.2 lib/neo4j/shared.rb
neo4j-5.1.1 lib/neo4j/shared.rb