realize 1.0.0.pre.alpha.3 → 1.0.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: eb3e9cd917389279276aa968f492756ea7b4db901cdfd2a1065f55312c257874
4
- data.tar.gz: 17748da9bb8c6e502d48d095ec44482010b4715b5afeb225c00d53022c1c33d5
3
+ metadata.gz: d5725ecd097c45ce632cd82af3b5c03cd7f54dec0503c007ee28498a2ebe2f0e
4
+ data.tar.gz: c6731e9b7f14b3c7109e7a680ba107702dc2c65336e5cea75194f6f61501e796
5
5
  SHA512:
6
- metadata.gz: cf522c8f60b1d78a31469a8dac3518de16d654e8da4ce59553fb998a9d3aec2739a1caf39b94fbd996a308721c90204b0bacbf11f7f765e7e4dbea1d8bd9af31
7
- data.tar.gz: 537e1cd2b918b041079227025287551dbf2d006b950a1fee5471c4f0b65a7ee49a5d88b663355cbc026aa5c89c99e7a94279669d48767198bfa13d1ac8ffcfd3
6
+ metadata.gz: 1dc9995383fa3a27c3414cd1549871724583c19a1dccbda403b6dc6224927711a4d3309a894ddb9ed0c94587a2d7d37ac870a1fbe9fcc45a017073db39570ce0
7
+ data.tar.gz: 2cc2a27d5faa2aa2cd188c94051beaa1cf92acc2e499b1cf3762f667a0e4e27c2f9a750cfd687990cbdfcf52d86ee494278b4062af0ab091aa117b1ab7db035f
@@ -1,3 +1,3 @@
1
- # 1.0.0 (June 8th, 2020)
1
+ # 1.0.0 (June 9th, 2020)
2
2
 
3
3
  Initial Release, includes 15 initial transformers.
@@ -1,16 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'sort/direction'
4
+
3
5
  module Realize
4
6
  class Collection
5
- # Transformer to take an array of oibjects and sort by the given key
7
+ # Transformer to take an array of objects and sort by the given key
6
8
  # and by the given sort direction. Defaulting to ascending.
7
9
  class Sort
8
- module Direction
9
- ASCENDING = 'ASC'
10
- ASC = 'ASC'
11
- DESCENDING = 'DESC'
12
- DESC = 'DESC'
13
- end
14
10
  include Arrays
15
11
  include Direction
16
12
  acts_as_hashable
@@ -1,35 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'sort/direction'
4
-
5
3
  module Realize
6
4
  class Collection
7
- # Transformer to take an array of oibjects and sort by the given key
8
- # and by the given sort direction. Defaulting to ascending.
9
5
  class Sort
10
- include Arrays
11
- include Direction
12
- acts_as_hashable
13
-
14
- DEFAULT_ORDER = ASCENDING
15
-
16
- attr_reader :key, :order
17
-
18
- def initialize(key:, order: DEFAULT_ORDER)
19
- raise ArgumentError, 'key is required' if key.to_s.empty?
20
-
21
- @key = key
22
- @order = Direction.const_get(order.to_s.upcase.to_sym)
23
-
24
- freeze
25
- end
26
-
27
- def transform(_resolver, value, _time, _record)
28
- records = array(value)
29
-
30
- sorted = records.sort_by { |hsh| hsh[key.to_sym] }
31
-
32
- order == DESCENDING ? sorted.reverse : sorted
6
+ # Constants describing the possible values of 'direction' for a Sort instance.
7
+ module Direction
8
+ # providing a few different ways to specify.
9
+ ASCENDING = ASC = 'ASC'
10
+ DESCENDING = DESC = 'DESC'
33
11
  end
34
12
  end
35
13
  end
@@ -8,5 +8,5 @@
8
8
  #
9
9
 
10
10
  module Realize
11
- VERSION = '1.0.0-alpha.3'
11
+ VERSION = '1.0.0'
12
12
  end
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
 
29
29
  s.required_ruby_version = '>= 2.5'
30
30
 
31
- s.add_dependency('acts_as_hashable', '=1.2.0.pre.alpha.1')
31
+ s.add_dependency('acts_as_hashable', '~>1', '>=1.2.0')
32
32
  s.add_dependency('objectable', '~>1')
33
33
 
34
34
  s.add_development_dependency('guard-rspec', '~>4.7')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: realize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.alpha.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Ruggio
@@ -14,16 +14,22 @@ dependencies:
14
14
  name: acts_as_hashable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.0.pre.alpha.1
19
+ version: '1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.2.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - '='
27
+ - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: 1.2.0.pre.alpha.1
29
+ version: '1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.2.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: objectable
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -200,9 +206,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
206
  version: '2.5'
201
207
  required_rubygems_version: !ruby/object:Gem::Requirement
202
208
  requirements:
203
- - - ">"
209
+ - - ">="
204
210
  - !ruby/object:Gem::Version
205
- version: 1.3.1
211
+ version: '0'
206
212
  requirements: []
207
213
  rubygems_version: 3.0.3
208
214
  signing_key: