lexorank 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 705faccc54d5d09c0ce7e8239d777b79ebe9b8857ea2956c6b7f9378f0b027d6
4
- data.tar.gz: b61be364fc9dfffb76947d4ad8ae6462ac8d70490a33262bdb96ac8601e1eb7f
3
+ metadata.gz: 16b14456a70e95ee3731264cac2fcb7c27a0b9bd1c0ef10b336a697b17650515
4
+ data.tar.gz: 5241003b8b5e0a342fe86f96ce331d385e7af7fa988f349cce6b3287d9ee9c64
5
5
  SHA512:
6
- metadata.gz: 188136b56717efec3aa8dedcdd9f977506a21677814dbe2d85488fa6f2154abe877f1412a4aaab03c1aae7b8f8badacd1982b2f77b12718893594133e10e10ef
7
- data.tar.gz: afd223cb7e8a444cc0428cfab024e89044a9918cfe013972ea65d2c4250f4db70b6b5653d3d5ba989ad548f33f6fda34b6730f3a5053872e0f705f56187d7185
6
+ metadata.gz: 4aba6a5923fb5fecd412c0ffd3841d113fc4d969b8d7282b4b9cd195e410e3bae5fe8866cf7debc2c4d09103322294bcc9b1100dc53c3721b8529739f7409084
7
+ data.tar.gz: 95c198bd787908d8e138e5c32758e2532e2f5b2f78eb31f06f22536bdc60d0e88dc819c966ef70b842d5150fdc32247e8016e8a316aa2d863a2b0dd6195da5cc
@@ -22,32 +22,32 @@ module Lexorank::Rankable
22
22
  end
23
23
 
24
24
  module InstanceMethods
25
- def move_to_top(&)
26
- move_to(0, &)
25
+ def move_to_top(...)
26
+ move_to(0, ...)
27
27
  end
28
28
 
29
- def move_to_end(&)
30
- self.class.lexorank_ranking.move_to(self, :last, &)
29
+ def move_to_end(...)
30
+ self.class.lexorank_ranking.move_to(self, :last, ...)
31
31
  end
32
32
 
33
- def move_to(position, &)
34
- self.class.lexorank_ranking.move_to(self, position, &)
33
+ def move_to(...)
34
+ self.class.lexorank_ranking.move_to(self, ...)
35
35
  end
36
36
 
37
- def move_to!(position)
38
- move_to(position) do
37
+ def move_to!(position, **options)
38
+ move_to(position, **options) do
39
39
  save
40
40
  end
41
41
  end
42
42
 
43
- def move_to_top!
44
- move_to_top do
43
+ def move_to_top!(**options)
44
+ move_to_top(**options) do
45
45
  save
46
46
  end
47
47
  end
48
48
 
49
- def move_to_end!
50
- move_to_end do
49
+ def move_to_end!(**options)
50
+ move_to_end(**options) do
51
51
  save
52
52
  end
53
53
  end
@@ -29,10 +29,10 @@ class Lexorank::Ranking
29
29
  end
30
30
  end
31
31
 
32
- def move_to(instance, position)
32
+ def move_to(instance, position, **options)
33
33
  if block_given? && advisory_locks_enabled?
34
- return with_lock_if_enabled(instance) do
35
- move_to(instance, position)
34
+ return with_lock_if_enabled(instance, **options.fetch(:advisory_lock, {})) do
35
+ move_to(instance, position, **options)
36
36
  yield
37
37
  end
38
38
  end
@@ -78,9 +78,9 @@ class Lexorank::Ranking
78
78
  end
79
79
  end
80
80
 
81
- def with_lock_if_enabled(instance, &)
81
+ def with_lock_if_enabled(instance, **options, &)
82
82
  if advisory_locks_enabled?
83
- advisory_lock_options = advisory_lock_config.except(:enabled, :lock_name)
83
+ advisory_lock_options = advisory_lock_config.except(:enabled, :lock_name).merge(options)
84
84
 
85
85
  record_class.with_advisory_lock(advisory_lock_name(instance), **advisory_lock_options, &)
86
86
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lexorank
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexorank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Böhme
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-28 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubygems_version: 3.5.9
76
+ rubygems_version: 3.5.11
77
77
  signing_key:
78
78
  specification_version: 4
79
79
  summary: Store order of your models by using lexicographic sorting.