sorted-activerecord 0.1.2 → 0.1.3

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
  SHA1:
3
- metadata.gz: dad88b26febe4a092e3832ecf4a981590629768e
4
- data.tar.gz: 59a3842b4e0a927c118054c0bca71cdb1259bbc5
3
+ metadata.gz: 9856512bf3a6ea77c80b2e533a1eb9f9733b6581
4
+ data.tar.gz: 5c64bec217bea4dd89b953e591eb4ff18ea75fd9
5
5
  SHA512:
6
- metadata.gz: 5384beb8cc7de376e714fc8d5fcb8cc9feb75d354fa820ee2373fccb6d80a879b2418691c5ddc5a36d47969f87f0507ae39c7977e11c99b97a80c3900abf1671
7
- data.tar.gz: 922d9586a74b8345f5011fe48c8f5233cd05a78b682faf835e87c6344a9115da962d69360aa0eed9fbfe7abd20a6a5b5444402cfec5e651afcb20b6072b44216
6
+ metadata.gz: e1fb82ad13affa7e882956be1f74a910bdf9e4b47a22cae92b5cbc0651b4e2af8e4ccc9732c9fa099e14477ab09b5056859a3276a6dfa73009a7e3280bd034aa
7
+ data.tar.gz: 6d1b300d549bc2dabde078e722ffda9a31ca3ded35abc1244d874b21a91f7a3c503baeb692083a1fb40739a11ae7c5523765b9b368d541d857ab61dbfb3c4f75
data/.rubocop.yml CHANGED
@@ -1,12 +1,13 @@
1
- # Offense count: 5
2
- # Configuration parameters: AllowURI, URISchemes.
3
1
  Metrics/LineLength:
4
2
  Max: 174
5
3
 
6
- # Offense count: 5
7
4
  Style/Documentation:
8
5
  Enabled: false
9
6
 
10
- # Offense count: 2
11
- Style/RegexpLiteral:
12
- MaxSlashes: 0
7
+ SignalException:
8
+ # prefer raise to fail
9
+ EnforcedStyle: only_raise
10
+
11
+ Lint/HandleExceptions:
12
+ Exclude:
13
+ - 'lib/sorted/active_record.rb'
data/.travis.yml CHANGED
@@ -1,7 +1,22 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
- - 2.1.5
4
+ - 2.1
5
+ - 2.2
5
6
  - ruby-head
7
+ - jruby-19mode
8
+ - jruby-head
9
+
10
+ before_install:
11
+ - gem update bundler
6
12
 
7
13
  script: bundle exec rake spec
14
+
15
+ matrix:
16
+ allow_failures:
17
+ - rvm: ruby-head
18
+ - rvm: jruby-head
19
+ fast_finish: true
20
+
21
+ notifications:
22
+ email: false
data/Guardfile CHANGED
@@ -1,5 +1,5 @@
1
- guard :rspec, cmd: "bundle exec rspec" do
2
- require "guard/rspec/dsl"
1
+ guard :rspec, cmd: 'bundle exec rspec' do
2
+ require 'guard/rspec/dsl'
3
3
  dsl = Guard::RSpec::Dsl.new(self)
4
4
 
5
5
  # RSpec files
@@ -1,4 +1,6 @@
1
- require 'sorted'
1
+ require 'sorted/set'
2
+ require 'sorted/sql_query'
3
+ require 'sorted/uri_query'
2
4
 
3
5
  module Sorted
4
6
  module ActiveRecord
@@ -42,14 +44,16 @@ module Sorted
42
44
  end
43
45
  end
44
46
 
47
+ # rubocop:disable Metrics/MethodLength
48
+ # rubocop:disable Metrics/AbcSize
45
49
  def parse(values)
46
50
  values.inject(Sorted::Set.new) do |memo, value|
47
51
  case value.class.name
48
52
  when 'Hash'
49
- memo = memo + parse(value.to_a)
53
+ memo += parse(value.to_a)
50
54
  when 'String'
51
55
  @return_hash = false
52
- memo = memo + ::Sorted::SQLQuery.parse(value)
56
+ memo += ::Sorted::SQLQuery.parse(value)
53
57
  when 'Symbol'
54
58
  memo = memo << [value.to_s, 'asc']
55
59
  when 'Array'
@@ -7,7 +7,6 @@ module Sorted
7
7
  module Helper
8
8
  extend ActiveSupport::Concern
9
9
  included do
10
-
11
10
  def self.sorted(sort: [], order: [], whitelist: [])
12
11
  builder = ::Sorted::ActiveRecord::Builder.new(sort: sort,
13
12
  order: order,
@@ -1,5 +1,5 @@
1
1
  module Sorted
2
2
  module ActiveRecord
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  begin
2
2
  require 'rails'
3
3
  rescue LoadError
4
- #do nothing
4
+ # do nothing
5
5
  end
6
6
 
7
7
  require 'sorted/active_record/version'
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = 'sorted-activerecord'
8
8
  spec.version = Sorted::ActiveRecord::VERSION
9
9
  spec.authors = ['Rufus Post']
10
- spec.email = ['Rufus.Post@team.telstra.com']
10
+ spec.email = ['rufuspost@gmail.com']
11
11
  spec.summary = 'Activerecord scoped for sorted.'
12
12
  spec.description = 'Allows the use of the sorted gem with Activerecord.'
13
13
  spec.homepage = ''
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'activerecord', '>= 4.0.0'
22
22
  spec.add_dependency 'activesupport'
23
- spec.add_dependency 'sorted', '~> 2.0.2'
23
+ spec.add_dependency 'sorted', '~> 2.1.2'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.7'
26
26
  spec.add_development_dependency 'rake', '~> 10.0'
@@ -56,19 +56,19 @@ describe Sorted::ActiveRecord do
56
56
  end
57
57
 
58
58
  it 'should allow hash as order' do
59
- expected = subject.order({ created_at: :desc }).to_sql
59
+ expected = subject.order(created_at: :desc).to_sql
60
60
  actual = subject.sorted(order: [{ created_at: :desc }]).to_sql
61
61
  expect(actual).to match(expected)
62
62
  end
63
63
 
64
64
  it 'should allow hash as sort' do
65
- expected = subject.order({ created_at: :desc }).to_sql
65
+ expected = subject.order(created_at: :desc).to_sql
66
66
  actual = subject.sorted(sort: [{ created_at: :desc }]).to_sql
67
67
  expect(actual).to match(expected)
68
68
  end
69
69
 
70
70
  it 'should allow symbols and hash as order' do
71
- expected = subject.order(:orders_count, { created_at: :desc }).to_sql
71
+ expected = subject.order(:orders_count, created_at: :desc).to_sql
72
72
  actual = subject.sorted(sort: [:orders_count, { created_at: :desc }]).to_sql
73
73
  expect(actual).to match(expected)
74
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorted-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rufus Post
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-11 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.2
47
+ version: 2.1.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.2
54
+ version: 2.1.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +152,7 @@ dependencies:
152
152
  version: 1.3.5
153
153
  description: Allows the use of the sorted gem with Activerecord.
154
154
  email:
155
- - Rufus.Post@team.telstra.com
155
+ - rufuspost@gmail.com
156
156
  executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []