activecypher 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cee43c77d5c77240791bd23a3ea08410ae58034f29f86d4bd0ec35bc65640b43
4
- data.tar.gz: 9a5947493ac00f596f11a3ae6e5ceba5c1bb145b56a203c38e27f9c011790fdb
3
+ metadata.gz: 1f1c222ac52b28439402e7b5bdbd0b3245c2530ce75227a9b35ef47917225327
4
+ data.tar.gz: d0cb17f1db87febfdb693f0fc85970b1d4b8e6c7555ae5424be1b04cbcf1eee9
5
5
  SHA512:
6
- metadata.gz: 8465c9e97cd9ce106b7a77e252714c72ac0fcb5470b35eccc0315e9277830402157ef07671b3a1cc757f757be0719f7475781a515322113bf23c698c88bd473c
7
- data.tar.gz: fbb7585d26ac13eda94bad3e72a7511d133d80ba4b4840c3c9001f323d818f6d6c61d45f26916a1e40ef93555bb1a75e6d4240e776f1d31f22412023faf9dbd3
6
+ metadata.gz: 3a8f60aacaea3ed7b3a4fb53e92b042237392d809304f1d17c59ebdb3c6b8e4ea221c44beaa6868a7e2e80859bbdb6f438c1cff65b2eff186b4dcd2f18c9c43a
7
+ data.tar.gz: ea5cdba9b038ca87809698de82982613f3a1c6efc33365bf9b01f07216edbb5bfcf5007f07cd5b9f0d360a830ec86c95e9e00b695bdafc42ac1cc242ed7c663e
@@ -155,14 +155,14 @@ module ActiveCypher
155
155
 
156
156
  # -- factories -----------------------------------------------
157
157
  # Mirrors ActiveRecord.create
158
- def create(attrs = {}, from_node:, to_node:)
159
- new(attrs, from_node: from_node, to_node: to_node).tap(&:save)
158
+ def create(attrs = {}, from_node:, to_node:, **attribute_kwargs)
159
+ new(attrs, from_node: from_node, to_node: to_node, **attribute_kwargs).tap(&:save)
160
160
  end
161
161
 
162
162
  # Bang version of create - raises exception if save fails
163
163
  # For when you want your relationship failures to be as dramatic as your breakups
164
- def create!(attrs = {}, from_node:, to_node:)
165
- relationship = create(attrs, from_node: from_node, to_node: to_node)
164
+ def create!(attrs = {}, from_node:, to_node:, **attribute_kwargs)
165
+ relationship = create(attrs, from_node: from_node, to_node: to_node, **attribute_kwargs)
166
166
  if relationship.persisted?
167
167
  relationship
168
168
  else
@@ -267,10 +267,15 @@ module ActiveCypher
267
267
  attr_accessor :from_node, :to_node
268
268
  attr_reader :new_record
269
269
 
270
- def initialize(attrs = {}, from_node: nil, to_node: nil)
270
+ def initialize(attrs = {}, from_node: nil, to_node: nil, **attribute_kwargs)
271
271
  _run(:initialize) do
272
272
  super()
273
- assign_attributes(attrs) if attrs
273
+
274
+ # Merge explicit attrs hash with keyword arguments for attributes.
275
+ # Note: `attribute_kwargs` takes precedence over `attrs` for keys that exist in both.
276
+ combined_attrs = attrs.merge(attribute_kwargs)
277
+ assign_attributes(combined_attrs) if combined_attrs.any?
278
+
274
279
  @from_node = from_node
275
280
  @to_node = to_node
276
281
  @new_record = true
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveCypher
4
- VERSION = '0.10.0'
4
+ VERSION = '0.10.1'
5
5
 
6
6
  def self.gem_version
7
7
  Gem::Version.new VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activecypher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih