activegraph 10.0.0.pre.alpha.11 → 10.0.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/{neo4j.gemspec → activegraph.gemspec} +7 -9
  4. data/config/neo4j/config.yml +4 -4
  5. data/lib/active_graph.rb +120 -0
  6. data/lib/{neo4j → active_graph}/ansi.rb +1 -1
  7. data/lib/{neo4j → active_graph}/attribute_set.rb +3 -3
  8. data/lib/{neo4j/active_base.rb → active_graph/base.rb} +18 -12
  9. data/lib/{neo4j → active_graph}/class_arguments.rb +5 -5
  10. data/lib/{neo4j → active_graph}/config.rb +10 -10
  11. data/lib/active_graph/core.rb +14 -0
  12. data/lib/{neo4j → active_graph}/core/connection_failed_error.rb +1 -1
  13. data/lib/{neo4j → active_graph}/core/cypher_error.rb +1 -1
  14. data/lib/{neo4j → active_graph}/core/driver.rb +5 -5
  15. data/lib/{neo4j → active_graph}/core/has_uri.rb +1 -1
  16. data/lib/{neo4j → active_graph}/core/instrumentable.rb +4 -4
  17. data/lib/{neo4j → active_graph}/core/label.rb +13 -13
  18. data/lib/{neo4j → active_graph}/core/logging.rb +2 -2
  19. data/lib/{neo4j → active_graph}/core/node.rb +2 -2
  20. data/lib/{neo4j → active_graph}/core/querable.rb +7 -7
  21. data/lib/{neo4j → active_graph}/core/query.rb +16 -16
  22. data/lib/{neo4j → active_graph}/core/query_builder.rb +3 -3
  23. data/lib/{neo4j → active_graph}/core/query_clauses.rb +1 -1
  24. data/lib/{neo4j → active_graph}/core/query_ext.rb +5 -5
  25. data/lib/{neo4j → active_graph}/core/query_find_in_batches.rb +2 -2
  26. data/lib/{neo4j → active_graph}/core/relationship.rb +2 -2
  27. data/lib/{neo4j → active_graph}/core/responses.rb +3 -3
  28. data/lib/{neo4j → active_graph}/core/result.rb +1 -1
  29. data/lib/{neo4j → active_graph}/core/schema.rb +1 -1
  30. data/lib/{neo4j → active_graph}/core/schema_errors.rb +1 -1
  31. data/lib/{neo4j → active_graph}/core/wrappable.rb +1 -1
  32. data/lib/{neo4j → active_graph}/errors.rb +1 -1
  33. data/lib/{neo4j → active_graph}/lazy_attribute_hash.rb +1 -1
  34. data/lib/{neo4j → active_graph}/migration.rb +11 -11
  35. data/lib/{neo4j → active_graph}/migrations.rb +5 -5
  36. data/lib/{neo4j → active_graph}/migrations/base.rb +7 -7
  37. data/lib/{neo4j → active_graph}/migrations/check_pending.rb +3 -3
  38. data/lib/{neo4j → active_graph}/migrations/helpers.rb +4 -4
  39. data/lib/{neo4j → active_graph}/migrations/helpers/id_property.rb +3 -3
  40. data/lib/{neo4j → active_graph}/migrations/helpers/relationships.rb +1 -1
  41. data/lib/{neo4j → active_graph}/migrations/helpers/schema.rb +7 -7
  42. data/lib/{neo4j → active_graph}/migrations/migration_file.rb +1 -1
  43. data/lib/{neo4j → active_graph}/migrations/runner.rb +3 -3
  44. data/lib/{neo4j → active_graph}/migrations/schema.rb +1 -1
  45. data/lib/{neo4j → active_graph}/migrations/schema_migration.rb +2 -2
  46. data/lib/{neo4j → active_graph}/model_schema.rb +8 -8
  47. data/lib/{neo4j/active_node.rb → active_graph/node.rb} +32 -32
  48. data/lib/{neo4j/active_node → active_graph/node}/callbacks.rb +3 -3
  49. data/lib/{neo4j/active_node → active_graph/node}/dependent.rb +2 -2
  50. data/lib/{neo4j/active_node → active_graph/node}/dependent/association_methods.rb +2 -2
  51. data/lib/{neo4j/active_node → active_graph/node}/dependent/query_proxy_methods.rb +4 -4
  52. data/lib/{neo4j/active_node → active_graph/node}/dependent_callbacks.rb +4 -4
  53. data/lib/{neo4j/active_node → active_graph/node}/enum.rb +3 -3
  54. data/lib/{neo4j/active_node → active_graph/node}/has_n.rb +20 -20
  55. data/lib/{neo4j/active_node → active_graph/node}/has_n/association.rb +8 -8
  56. data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_factory.rb +4 -4
  57. data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_wrapper.rb +4 -4
  58. data/lib/{neo4j/active_node → active_graph/node}/has_n/association_cypher_methods.rb +2 -2
  59. data/lib/{neo4j/active_node → active_graph/node}/id_property.rb +7 -7
  60. data/lib/{neo4j/active_node → active_graph/node}/id_property/accessor.rb +1 -1
  61. data/lib/{neo4j/active_node → active_graph/node}/initialize.rb +3 -3
  62. data/lib/{neo4j/active_node → active_graph/node}/labels.rb +18 -18
  63. data/lib/{neo4j/active_node → active_graph/node}/labels/index.rb +6 -6
  64. data/lib/{neo4j/active_node → active_graph/node}/labels/reloading.rb +1 -1
  65. data/lib/{neo4j/active_node → active_graph/node}/node_list_formatter.rb +1 -1
  66. data/lib/{neo4j/active_node → active_graph/node}/node_wrapper.rb +5 -5
  67. data/lib/{neo4j/active_node → active_graph/node}/orm_adapter.rb +2 -2
  68. data/lib/{neo4j/active_node → active_graph/node}/persistence.rb +7 -7
  69. data/lib/{neo4j/active_node → active_graph/node}/property.rb +3 -3
  70. data/lib/{neo4j/active_node → active_graph/node}/query.rb +9 -9
  71. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy.rb +19 -19
  72. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading.rb +3 -3
  73. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading/association_tree.rb +2 -2
  74. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_enumerable.rb +4 -4
  75. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_find_in_batches.rb +2 -2
  76. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_link.rb +3 -3
  77. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods.rb +12 -12
  78. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods_of_mass_updating.rb +4 -4
  79. data/lib/{neo4j/active_node → active_graph/node}/query_methods.rb +4 -4
  80. data/lib/{neo4j/active_node → active_graph/node}/reflection.rb +3 -3
  81. data/lib/{neo4j/active_node → active_graph/node}/rels.rb +1 -1
  82. data/lib/{neo4j/active_node → active_graph/node}/scope.rb +4 -4
  83. data/lib/{neo4j/active_node → active_graph/node}/unpersisted.rb +2 -2
  84. data/lib/{neo4j/active_node → active_graph/node}/validations.rb +3 -3
  85. data/lib/{neo4j → active_graph}/paginated.rb +1 -1
  86. data/lib/{neo4j → active_graph}/railtie.rb +18 -18
  87. data/lib/{neo4j/active_rel.rb → active_graph/relationship.rb} +19 -19
  88. data/lib/active_graph/relationship/callbacks.rb +21 -0
  89. data/lib/{neo4j/active_rel → active_graph/relationship}/initialize.rb +5 -5
  90. data/lib/{neo4j/active_rel → active_graph/relationship}/persistence.rb +6 -6
  91. data/lib/{neo4j/active_rel → active_graph/relationship}/persistence/query_factory.rb +7 -7
  92. data/lib/{neo4j/active_rel → active_graph/relationship}/property.rb +6 -6
  93. data/lib/{neo4j/active_rel → active_graph/relationship}/query.rb +7 -7
  94. data/lib/{neo4j/active_rel → active_graph/relationship}/rel_wrapper.rb +5 -5
  95. data/lib/{neo4j/active_rel → active_graph/relationship}/related_node.rb +7 -7
  96. data/lib/{neo4j/active_rel → active_graph/relationship}/types.rb +6 -6
  97. data/lib/active_graph/relationship/validations.rb +8 -0
  98. data/lib/{neo4j → active_graph}/schema/operation.rb +5 -5
  99. data/lib/{neo4j → active_graph}/shared.rb +7 -7
  100. data/lib/{neo4j → active_graph}/shared/attributes.rb +10 -10
  101. data/lib/{neo4j → active_graph}/shared/callbacks.rb +3 -3
  102. data/lib/{neo4j → active_graph}/shared/cypher.rb +1 -1
  103. data/lib/{neo4j → active_graph}/shared/declared_properties.rb +8 -8
  104. data/lib/{neo4j → active_graph}/shared/declared_property.rb +9 -9
  105. data/lib/{neo4j → active_graph}/shared/declared_property/index.rb +3 -3
  106. data/lib/{neo4j → active_graph}/shared/enum.rb +6 -6
  107. data/lib/{neo4j → active_graph}/shared/filtered_hash.rb +2 -2
  108. data/lib/{neo4j → active_graph}/shared/identity.rb +2 -2
  109. data/lib/{neo4j → active_graph}/shared/initialize.rb +3 -3
  110. data/lib/{neo4j → active_graph}/shared/marshal.rb +1 -1
  111. data/lib/{neo4j → active_graph}/shared/mass_assignment.rb +2 -2
  112. data/lib/{neo4j → active_graph}/shared/permitted_attributes.rb +1 -1
  113. data/lib/{neo4j → active_graph}/shared/persistence.rb +4 -4
  114. data/lib/{neo4j → active_graph}/shared/property.rb +10 -10
  115. data/lib/{neo4j → active_graph}/shared/query_factory.rb +5 -5
  116. data/lib/{neo4j → active_graph}/shared/rel_type_converters.rb +6 -6
  117. data/lib/{neo4j → active_graph}/shared/serialized_properties.rb +1 -1
  118. data/lib/{neo4j → active_graph}/shared/type_converters.rb +11 -13
  119. data/lib/{neo4j → active_graph}/shared/typecasted_attributes.rb +7 -7
  120. data/lib/{neo4j → active_graph}/shared/typecaster.rb +3 -3
  121. data/lib/{neo4j → active_graph}/shared/validations.rb +1 -1
  122. data/lib/{neo4j → active_graph}/tasks/migration.rake +25 -25
  123. data/lib/{neo4j → active_graph}/timestamps.rb +3 -3
  124. data/lib/{neo4j → active_graph}/timestamps/created.rb +1 -1
  125. data/lib/{neo4j → active_graph}/timestamps/updated.rb +1 -1
  126. data/lib/{neo4j → active_graph}/transaction.rb +9 -9
  127. data/lib/active_graph/transactions.rb +54 -0
  128. data/lib/{neo4j → active_graph}/type_converters.rb +2 -2
  129. data/lib/{neo4j → active_graph}/undeclared_properties.rb +1 -1
  130. data/lib/active_graph/version.rb +3 -0
  131. data/lib/{neo4j → active_graph}/wrapper.rb +1 -1
  132. data/lib/rails/generators/neo4j/migration/migration_generator.rb +4 -4
  133. data/lib/rails/generators/neo4j/migration/templates/migration.erb +2 -2
  134. data/lib/rails/generators/neo4j/model/model_generator.rb +4 -4
  135. data/lib/rails/generators/neo4j/model/templates/migration.erb +1 -1
  136. data/lib/rails/generators/neo4j/model/templates/model.erb +1 -1
  137. data/lib/rails/generators/neo4j/upgrade_v8/templates/migration.erb +1 -1
  138. data/lib/rails/generators/neo4j/upgrade_v8/upgrade_v8_generator.rb +6 -6
  139. data/lib/rails/generators/neo4j_generator.rb +4 -4
  140. metadata +134 -133
  141. data/lib/neo4j.rb +0 -119
  142. data/lib/neo4j/active_rel/callbacks.rb +0 -21
  143. data/lib/neo4j/active_rel/validations.rb +0 -8
  144. data/lib/neo4j/core.rb +0 -14
  145. data/lib/neo4j/version.rb +0 -3
@@ -1,18 +1,18 @@
1
- require 'neo4j/core/relationship'
1
+ require 'active_graph/core/relationship'
2
2
 
3
3
  wrapping_proc = proc do |relationship|
4
- Neo4j::RelWrapping.wrapper(relationship)
4
+ ActiveGraph::RelWrapping.wrapper(relationship)
5
5
  end
6
6
  Neo4j::Driver::Types::Relationship.wrapper_callback(wrapping_proc)
7
7
 
8
- module Neo4j
8
+ module ActiveGraph
9
9
  module RelWrapping
10
10
  class << self
11
11
  def wrapper(rel)
12
12
  rel.props.symbolize_keys!
13
13
  begin
14
14
  most_concrete_class = class_from_type(rel.rel_type).constantize
15
- return rel unless most_concrete_class < Neo4j::ActiveRel
15
+ return rel unless most_concrete_class < ActiveGraph::Relationship
16
16
  most_concrete_class.new
17
17
  rescue NameError => e
18
18
  raise e unless e.message =~ /(uninitialized|wrong) constant/
@@ -24,7 +24,7 @@ module Neo4j
24
24
  end
25
25
 
26
26
  def class_from_type(rel_type)
27
- Neo4j::ActiveRel::Types::WRAPPED_CLASSES[rel_type] || Neo4j::ActiveRel::Types::WRAPPED_CLASSES[rel_type] = rel_type.to_s.downcase.camelize
27
+ ActiveGraph::Relationship::Types::WRAPPED_CLASSES[rel_type] || ActiveGraph::Relationship::Types::WRAPPED_CLASSES[rel_type] = rel_type.to_s.downcase.camelize
28
28
  end
29
29
  end
30
30
  end
@@ -1,18 +1,18 @@
1
- module Neo4j::ActiveRel
2
- # A container for ActiveRel's :inbound and :outbound methods. It provides lazy loading of nodes.
1
+ module ActiveGraph::Relationship
2
+ # A container for Relationship's :inbound and :outbound methods. It provides lazy loading of nodes.
3
3
  # It's important (or maybe not really IMPORTANT, but at least worth mentioning) that calling method_missing
4
4
  # will result in a query to load the node if the node is not already loaded.
5
5
  class RelatedNode
6
- class UnsetRelatedNodeError < Neo4j::Error; end
6
+ class UnsetRelatedNodeError < ActiveGraph::Error; end
7
7
 
8
- # ActiveRel's related nodes can be initialized with nothing, an integer, or a fully wrapped node.
8
+ # Relationship's related nodes can be initialized with nothing, an integer, or a fully wrapped node.
9
9
  #
10
- # Initialization with nothing happens when a new, non-persisted ActiveRel object is first initialized.
10
+ # Initialization with nothing happens when a new, non-persisted Relationship object is first initialized.
11
11
  #
12
12
  # Initialization with an integer happens when a relationship is loaded from the database. It loads using the ID
13
13
  # because that is provided by the Cypher response and does not require an extra query.
14
14
  def initialize(node = nil)
15
- @node = valid_node_param?(node) ? node : (fail Neo4j::InvalidParameterError, 'RelatedNode must be initialized with either a node ID or node')
15
+ @node = valid_node_param?(node) ? node : (fail ActiveGraph::InvalidParameterError, 'RelatedNode must be initialized with either a node ID or node')
16
16
  end
17
17
 
18
18
  # Loads the node if needed, then conducts comparison.
@@ -32,7 +32,7 @@ module Neo4j::ActiveRel
32
32
  @node = if @node.respond_to?(:neo_id)
33
33
  @node
34
34
  else
35
- Neo4j::ActiveBase.new_query.match(:n).where(n: {neo_id: @node}).pluck(:n).first
35
+ ActiveGraph::Base.new_query.match(:n).where(n: {neo_id: @node}).pluck(:n).first
36
36
  end
37
37
  end
38
38
 
@@ -1,10 +1,10 @@
1
- module Neo4j
2
- module ActiveRel
1
+ module ActiveGraph
2
+ module Relationship
3
3
  # provides mapping of type to model name
4
4
  module Types
5
5
  extend ActiveSupport::Concern
6
6
 
7
- # WRAPPED_CLASSES maps relationship types to ActiveRel models.
7
+ # WRAPPED_CLASSES maps relationship types to Relationship models.
8
8
  #
9
9
  # Typically, it's a 1:1 relationship, with a type having a model of the same name. Sometimes, someone needs to be a precious
10
10
  # snowflake and have a model name that doesn't match the rel type, so this comes in handy.
@@ -22,7 +22,7 @@ module Neo4j
22
22
  end
23
23
 
24
24
  module ClassMethods
25
- include Neo4j::Shared::RelTypeConverters
25
+ include ActiveGraph::Shared::RelTypeConverters
26
26
 
27
27
  def inherited(subclass)
28
28
  subclass.type subclass.namespaced_model_name, true
@@ -46,11 +46,11 @@ module Neo4j
46
46
  alias _type type # should be deprecated
47
47
 
48
48
  def namespaced_model_name
49
- case Neo4j::Config[:module_handling]
49
+ case ActiveGraph::Config[:module_handling]
50
50
  when :demodulize
51
51
  self.name.demodulize
52
52
  when Proc
53
- Neo4j::Config[:module_handling].call(self.name)
53
+ ActiveGraph::Config[:module_handling].call(self.name)
54
54
  else
55
55
  self.name
56
56
  end
@@ -0,0 +1,8 @@
1
+ module ActiveGraph
2
+ module Relationship
3
+ module Validations
4
+ extend ActiveSupport::Concern
5
+ include ActiveGraph::Shared::Validations
6
+ end
7
+ end
8
+ end
@@ -1,13 +1,13 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Schema
3
3
  class Operation
4
4
  attr_reader :label, :property, :options
5
5
 
6
6
  def initialize(label, property, options = default_options)
7
- @label = if label.is_a?(Neo4j::Core::Label)
7
+ @label = if label.is_a?(ActiveGraph::Core::Label)
8
8
  label
9
9
  else
10
- Neo4j::Core::Label.new(label)
10
+ ActiveGraph::Core::Label.new(label)
11
11
  end
12
12
 
13
13
  @property = property.to_sym
@@ -62,7 +62,7 @@ module Neo4j
62
62
  end
63
63
  end
64
64
 
65
- class ExactIndexOperation < Neo4j::Schema::Operation
65
+ class ExactIndexOperation < ActiveGraph::Schema::Operation
66
66
  def self.incompatible_operation_classes
67
67
  [UniqueConstraintOperation]
68
68
  end
@@ -76,7 +76,7 @@ module Neo4j
76
76
  end
77
77
  end
78
78
 
79
- class UniqueConstraintOperation < Neo4j::Schema::Operation
79
+ class UniqueConstraintOperation < ActiveGraph::Schema::Operation
80
80
  def self.incompatible_operation_classes
81
81
  [ExactIndexOperation]
82
82
  end
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Shared
3
3
  extend ActiveSupport::Concern
4
4
  extend ActiveModel::Naming
@@ -14,28 +14,28 @@ module Neo4j
14
14
 
15
15
  # remove?
16
16
  def neo4j_driver
17
- Neo4j::ActiveBase.current_driver
17
+ ActiveGraph::Base.current_driver
18
18
  end
19
19
 
20
20
  # remove?
21
21
  def current_transaction
22
- Neo4j::ActiveBase.current_transaction
22
+ ActiveGraph::Base.current_transaction
23
23
  end
24
24
 
25
25
  # This should be used everywhere. Should make it easy
26
26
  # to support a driver-per-model system
27
27
  def neo4j_query(*args)
28
- Neo4j::ActiveBase.query(*args)
28
+ ActiveGraph::Base.query(*args)
29
29
  end
30
30
 
31
31
  def new_query
32
- Neo4j::ActiveBase.new_query
32
+ ActiveGraph::Base.new_query
33
33
  end
34
34
  end
35
35
 
36
36
  included do
37
- self.include_root_in_json = Neo4j::Config.include_root_in_json
38
- @_declared_properties ||= Neo4j::Shared::DeclaredProperties.new(self)
37
+ self.include_root_in_json = ActiveGraph::Config.include_root_in_json
38
+ @_declared_properties ||= ActiveGraph::Shared::DeclaredProperties.new(self)
39
39
 
40
40
  def self.i18n_scope
41
41
  :neo4j
@@ -1,10 +1,10 @@
1
- module Neo4j::Shared
1
+ module ActiveGraph::Shared
2
2
  # Attributes provides a set of class methods for defining an attributes
3
3
  # schema and instance methods for reading and writing attributes.
4
4
  #
5
5
  # @example Usage
6
6
  # class Person
7
- # include Neo4j::Shared::Attributes
7
+ # include ActiveGraph::Shared::Attributes
8
8
  # attribute :name
9
9
  # end
10
10
  #
@@ -61,14 +61,14 @@ module Neo4j::Shared
61
61
  #
62
62
  # @raise [UnknownAttributeError] if the attribute is unknown
63
63
  def write_attribute(name, value)
64
- fail Neo4j::UnknownAttributeError, "unknown attribute: #{name}" if !respond_to? "#{name}="
64
+ fail ActiveGraph::UnknownAttributeError, "unknown attribute: #{name}" if !respond_to? "#{name}="
65
65
 
66
66
  send "#{name}=", value
67
67
  end
68
68
  alias []= write_attribute
69
69
 
70
70
  def query_attribute(name)
71
- fail Neo4j::UnknownAttributeError, "unknown attribute: #{name}" if !respond_to? "#{name}?"
71
+ fail ActiveGraph::UnknownAttributeError, "unknown attribute: #{name}" if !respond_to? "#{name}?"
72
72
 
73
73
  send "#{name}?"
74
74
  end
@@ -77,13 +77,13 @@ module Neo4j::Shared
77
77
 
78
78
  # Read an attribute from the attributes hash
79
79
  def attribute(name)
80
- @attributes ||= Neo4j::AttributeSet.new({}, self.class.attributes.keys)
80
+ @attributes ||= ActiveGraph::AttributeSet.new({}, self.class.attributes.keys)
81
81
  @attributes.fetch_value(name.to_s)
82
82
  end
83
83
 
84
84
  # Write an attribute to the attributes hash
85
85
  def attribute=(name, value)
86
- @attributes ||= Neo4j::AttributeSet.new({}, self.class.attributes.keys)
86
+ @attributes ||= ActiveGraph::AttributeSet.new({}, self.class.attributes.keys)
87
87
  @attributes.write_cast_value(name, value)
88
88
  value
89
89
  end
@@ -102,7 +102,7 @@ module Neo4j::Shared
102
102
  end
103
103
 
104
104
  def attribute?(name)
105
- Neo4j::Shared::TypeConverters::BooleanConverter.to_ruby(read_attribute(name))
105
+ ActiveGraph::Shared::TypeConverters::BooleanConverter.to_ruby(read_attribute(name))
106
106
  end
107
107
 
108
108
  module ClassMethods
@@ -123,7 +123,7 @@ module Neo4j::Shared
123
123
  #
124
124
  # @return [AttributeDefinition] Attribute's definition
125
125
  def attribute(name)
126
- fail Neo4j::DangerousAttributeError, %(an attribute method named "#{name}" would conflict with an existing method) if dangerous_attribute?(name)
126
+ fail ActiveGraph::DangerousAttributeError, %(an attribute method named "#{name}" would conflict with an existing method) if dangerous_attribute?(name)
127
127
 
128
128
  attribute!(name)
129
129
  end
@@ -143,7 +143,7 @@ module Neo4j::Shared
143
143
  # @example Get attribute definitions
144
144
  # Person.attributes
145
145
  #
146
- # @return [ActiveSupport::HashWithIndifferentAccess{String => Neo4j::Shared::AttributeDefinition}]
146
+ # @return [ActiveSupport::HashWithIndifferentAccess{String => ActiveGraph::Shared::AttributeDefinition}]
147
147
  # The Hash of AttributeDefinition instances
148
148
  def attributes
149
149
  @attributes ||= ActiveSupport::HashWithIndifferentAccess.new
@@ -189,7 +189,7 @@ module Neo4j::Shared
189
189
 
190
190
  # Assign a set of attribute definitions, used when subclassing models
191
191
  #
192
- # @param [Array<Neo4j::Shared::DeclaredProperties>] The Array of
192
+ # @param [Array<ActiveGraph::Shared::DeclaredProperties>] The Array of
193
193
  # AttributeDefinition instances
194
194
  def attributes=(attributes)
195
195
  @attributes = attributes
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Shared
3
3
  module Callbacks #:nodoc:
4
4
  extend ActiveSupport::Concern
@@ -9,7 +9,7 @@ module Neo4j
9
9
 
10
10
  included do
11
11
  include ActiveModel::Validations::Callbacks
12
- # after_find is triggered by the `find` method defined in lib/neo4j/active_node/id_property.rb
12
+ # after_find is triggered by the `find` method defined in lib/neo4j/node/id_property.rb
13
13
  define_model_callbacks :initialize, :find, only: :after
14
14
  define_model_callbacks :create_commit, :update_commit, :destroy_commit, only: :after
15
15
  define_model_callbacks :save, :create, :update, :destroy, :touch
@@ -20,7 +20,7 @@ module Neo4j
20
20
  end
21
21
 
22
22
  def destroy #:nodoc:
23
- tx = Neo4j::ActiveBase.new_transaction
23
+ tx = ActiveGraph::Base.new_transaction
24
24
  tx.root.after_commit { run_callbacks(:destroy_commit) {} }
25
25
  run_callbacks(:destroy) { super }
26
26
  rescue
@@ -1,4 +1,4 @@
1
- module Neo4j::Shared
1
+ module ActiveGraph::Shared
2
2
  module Cypher
3
3
  module CreateMethod
4
4
  def create_method
@@ -1,17 +1,17 @@
1
- module Neo4j::Shared
1
+ module ActiveGraph::Shared
2
2
  # The DeclaredPropertyuManager holds details about objects created as a result of calling the #property
3
- # class method on a class that includes Neo4j::ActiveNode or Neo4j::ActiveRel. There are many options
3
+ # class method on a class that includes ActiveGraph::Node or ActiveGraph::Relationship. There are many options
4
4
  # that are referenced frequently, particularly during load and save, so this provides easy access and
5
5
  # a way of separating behavior from the general Active{obj} modules.
6
6
  #
7
- # See Neo4j::Shared::DeclaredProperty for definitions of the property objects themselves.
7
+ # See ActiveGraph::Shared::DeclaredProperty for definitions of the property objects themselves.
8
8
  class DeclaredProperties
9
- include Neo4j::Shared::TypeConverters
9
+ include ActiveGraph::Shared::TypeConverters
10
10
 
11
11
  attr_reader :klass
12
12
  delegate :each, :each_pair, :each_key, :each_value, to: :registered_properties
13
13
 
14
- # Each class that includes Neo4j::ActiveNode or Neo4j::ActiveRel gets one instance of this class.
14
+ # Each class that includes ActiveGraph::Node or ActiveGraph::Relationship gets one instance of this class.
15
15
  # @param [#declared_properties] klass An object that has the #declared_properties method.
16
16
  def initialize(klass)
17
17
  @klass = klass
@@ -25,8 +25,8 @@ module Neo4j::Shared
25
25
  registered_properties.key?(key.to_sym)
26
26
  end
27
27
 
28
- # @param [Neo4j::Shared::DeclaredProperty] property An instance of DeclaredProperty, created as the result of calling
29
- # #property on an ActiveNode or ActiveRel class. The DeclaredProperty has specifics about the property, but registration
28
+ # @param [ActiveGraph::Shared::DeclaredProperty] property An instance of DeclaredProperty, created as the result of calling
29
+ # #property on an Node or Relationship class. The DeclaredProperty has specifics about the property, but registration
30
30
  # makes the management object aware of it. This is necessary for type conversion, defaults, and inclusion in the nil and string hashes.
31
31
  def register(property)
32
32
  @_attributes_nil_hash = nil
@@ -48,7 +48,7 @@ module Neo4j::Shared
48
48
  registered_properties[key].constraint!(type)
49
49
  end
50
50
 
51
- # The :default option in Neo4j::ActiveNode#property class method allows for setting a default value instead of
51
+ # The :default option in ActiveGraph::Node#property class method allows for setting a default value instead of
52
52
  # nil on declared properties. This holds those values.
53
53
  def declared_property_defaults
54
54
  @_default_property_values ||= {}
@@ -1,10 +1,10 @@
1
- module Neo4j::Shared
1
+ module ActiveGraph::Shared
2
2
  # Contains methods related to the management
3
3
  class DeclaredProperty
4
4
  include Comparable
5
5
 
6
- class IllegalPropertyError < Neo4j::Error; end
7
- include Neo4j::Shared::DeclaredProperty::Index
6
+ class IllegalPropertyError < ActiveGraph::Error; end
7
+ include ActiveGraph::Shared::DeclaredProperty::Index
8
8
 
9
9
  ILLEGAL_PROPS = %w(from_node to_node start_node end_node)
10
10
  attr_reader :name, :name_string, :name_sym, :options, :magic_typecaster, :type, :typecaster, :default_value
@@ -27,7 +27,7 @@ module Neo4j::Shared
27
27
  # @example
28
28
  # attribute_definition <=> other
29
29
  #
30
- # @param [Neo4j::Shared::DeclaredProperty, Object] other The other
30
+ # @param [ActiveGraph::Shared::DeclaredProperty, Object] other The other
31
31
  # attribute definition to compare with.
32
32
  #
33
33
  # @return [-1, 0, 1, nil]
@@ -62,7 +62,7 @@ module Neo4j::Shared
62
62
  def fail_invalid_options!
63
63
  case
64
64
  when index?(:exact) && constraint?(:unique)
65
- fail Neo4j::InvalidPropertyOptionsError,
65
+ fail ActiveGraph::InvalidPropertyOptionsError,
66
66
  "#Uniqueness constraints also provide exact indexes, cannot set both options on property #{name}"
67
67
  end
68
68
  end
@@ -80,7 +80,7 @@ module Neo4j::Shared
80
80
 
81
81
  # Tweaks properties
82
82
  def register_magic_properties
83
- @type ||= Neo4j::Config.timestamp_type if timestamp_prop?
83
+ @type ||= ActiveGraph::Config.timestamp_type if timestamp_prop?
84
84
 
85
85
  register_magic_typecaster
86
86
  register_type_converter
@@ -91,7 +91,7 @@ module Neo4j::Shared
91
91
  end
92
92
 
93
93
  def register_magic_typecaster
94
- found_typecaster = Neo4j::Shared::TypeConverters.typecaster_for(type)
94
+ found_typecaster = ActiveGraph::Shared::TypeConverters.typecaster_for(type)
95
95
  return unless found_typecaster && found_typecaster.respond_to?(:primitive_type)
96
96
  @typecaster = found_typecaster
97
97
  @magic_typecaster = type
@@ -102,8 +102,8 @@ module Neo4j::Shared
102
102
  converter = options[:serializer]
103
103
  return unless converter
104
104
  @type = converter.convert_type
105
- @typecaster = Neo4j::Shared::TypeConverters::ObjectConverter
106
- Neo4j::Shared::TypeConverters.register_converter(converter)
105
+ @typecaster = ActiveGraph::Shared::TypeConverters::ObjectConverter
106
+ ActiveGraph::Shared::TypeConverters.register_converter(converter)
107
107
  end
108
108
  end
109
109
  end
@@ -1,4 +1,4 @@
1
- module Neo4j::Shared
1
+ module ActiveGraph::Shared
2
2
  class DeclaredProperty
3
3
  # None of these methods interact with the database. They only keep track of property settings in models.
4
4
  # It could (should?) handle the actual indexing/constraining, but that's TBD.
@@ -16,12 +16,12 @@ module Neo4j::Shared
16
16
  end
17
17
 
18
18
  def index!(type = :exact)
19
- fail Neo4j::InvalidPropertyOptionsError, "Can't set index on constrainted property #{name} (constraints get indexes automatically)" if constraint?(:unique)
19
+ fail ActiveGraph::InvalidPropertyOptionsError, "Can't set index on constrainted property #{name} (constraints get indexes automatically)" if constraint?(:unique)
20
20
  options[:index] = type
21
21
  end
22
22
 
23
23
  def constraint!(type = :unique)
24
- fail Neo4j::InvalidPropertyOptionsError, "Can't set constraint on indexed property #{name} (constraints get indexes automatically)" if index?(:exact)
24
+ fail ActiveGraph::InvalidPropertyOptionsError, "Can't set constraint on indexed property #{name} (constraints get indexes automatically)" if index?(:exact)
25
25
  options[:constraint] = type
26
26
  end
27
27
 
@@ -1,9 +1,9 @@
1
- module Neo4j::Shared
1
+ module ActiveGraph::Shared
2
2
  module Enum
3
3
  extend ActiveSupport::Concern
4
4
 
5
- class ConflictingEnumMethodError < Neo4j::Error; end
6
- class InvalidEnumValueError < Neo4j::InvalidParameterError; end
5
+ class ConflictingEnumMethodError < ActiveGraph::Error; end
6
+ class InvalidEnumValueError < ActiveGraph::InvalidParameterError; end
7
7
 
8
8
  module ClassMethods
9
9
  attr_reader :neo4j_enum_data
@@ -13,7 +13,7 @@ module Neo4j::Shared
13
13
  #
14
14
  # @example Base example
15
15
  # class Media
16
- # include Neo4j::ActiveNode
16
+ # include ActiveGraph::Node
17
17
  # enum type: [:image, :video, :unknown]
18
18
  # end
19
19
  # Media.types # => { :images => 0, :video => 1, :unknown => 2 }
@@ -55,7 +55,7 @@ module Neo4j::Shared
55
55
  protected
56
56
 
57
57
  def normalize_key_list(enum_keys, options)
58
- case_sensitive = options.fetch(:_case_sensitive, Neo4j::Config.enums_case_sensitive)
58
+ case_sensitive = options.fetch(:_case_sensitive, ActiveGraph::Config.enums_case_sensitive)
59
59
 
60
60
  case enum_keys
61
61
  when Hash
@@ -92,7 +92,7 @@ module Neo4j::Shared
92
92
 
93
93
  def define_property(property_name, enum_keys, options)
94
94
  property property_name, build_property_options(enum_keys, options)
95
- serialize property_name, Neo4j::Shared::TypeConverters::EnumConverter.new(enum_keys, build_enum_options(enum_keys, options))
95
+ serialize property_name, ActiveGraph::Shared::TypeConverters::EnumConverter.new(enum_keys, build_enum_options(enum_keys, options))
96
96
 
97
97
  # If class has already been inherited, make sure subclasses fully inherit enum
98
98
  subclasses.each do |klass|