hashid-rails 1.2.1 → 1.2.2

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
- SHA1:
3
- metadata.gz: 6796fd1b0c38d1df8d7fcd78d34b94d33f4a3369
4
- data.tar.gz: d350084ba5b79ab7a1a8ad0804971a9ab63602f6
2
+ SHA256:
3
+ metadata.gz: b4ea795a68ca182b4cf66429705dc4281272502ef4e9922551082ddb1dfad022
4
+ data.tar.gz: 38f04be13d9159eadd37075091f90ddb57bef4eaac679718681deae67cfc33d1
5
5
  SHA512:
6
- metadata.gz: 7ef74a3bfaae4abc770f454c40904c8a3d011d730957fbd80177249c9c8486d52e9d41796f654df243b63ab97b57c9547aa8868635bab88b51d0bb6df505e863
7
- data.tar.gz: 625758b6b7f65a6a470b7bfbdabc53b5eaee834d8c26dbdc3c73f2a55ef975ba58fb5bb6c7b5985b08128751f91aee7d8db6a9578401973e5188aad06db2d371
6
+ metadata.gz: 94cecc8c493920fb3aa1e0495e307989d6d1051ca8284580f11be3090f55a3c9821c34f8cb4248511c70537c618db1066f5ebdb3a654a7e1182c700f67e7eb30
7
+ data.tar.gz: 2ed1f2740f8f1d67fd2ce1997b6c06d6de4d8925eca00eb13dd9251a75406bac09635429d8a7e8177a4ef3b62af88825330e93fd7530746fcbd30ffeebd221cc
@@ -1,10 +1,15 @@
1
- Style/StringLiterals:
2
- EnforcedStyle: double_quotes
3
- Style/IndentArray:
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ Layout/IndentArray:
4
4
  EnforcedStyle: consistent
5
- Style/Documentation:
6
- Enabled: false
7
5
  Metrics/BlockLength:
8
6
  Exclude:
9
7
  - "*.gemspec"
10
8
  - "spec/**/*.rb"
9
+ Naming/PredicateName:
10
+ NameWhitelist:
11
+ - has_many
12
+ Style/Documentation:
13
+ Enabled: false
14
+ Style/StringLiterals:
15
+ EnforcedStyle: double_quotes
@@ -1,9 +1,15 @@
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=37aee70bb2e818f3bf4d2af88ea4a4355393901ba98b3876c244d42ed20fdbe1
1
4
  language: ruby
2
5
  cache: bundler
3
6
  rvm:
4
7
  - 2.3.0
5
- addons:
6
- code_climate:
7
- repo_token: 37aee70bb2e818f3bf4d2af88ea4a4355393901ba98b3876c244d42ed20fdbe1
8
- after_success:
9
- - bundle exec codeclimate-test-reporter
8
+ before_script:
9
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
10
+ - chmod +x ./cc-test-reporter
11
+ - ./cc-test-reporter before-build
12
+ script:
13
+ - bundle exec rspec
14
+ after_script:
15
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.2 (2018-07-29)
4
+ ### Fixed
5
+ - Handle exception raised when using a letter-only alphabet and attempting to
6
+ decode an integer ID from [@Drakula2k](https://github.com/Drakula2k) ([#54](https://github.com/jcypret/hashid-rails/pull/54)).
7
+
3
8
  ## 1.2.1 (2018-01-13)
4
9
  - Found issue where unsigned hashids with `find` did not fall back to passed in ID ([#46](https://github.com/jcypret/hashid-rails/pull/46)).
5
10
  - Move finder specs to a shared example run against both the signed and unsigned hashids.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in hashid-rails.gemspec
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
4
  require "rspec/core/rake_task"
3
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "hashid/rails"
@@ -1,4 +1,5 @@
1
- # coding: utf-8
1
+ # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path("../lib", __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require "hashid/rails/version"
@@ -10,13 +11,13 @@ Gem::Specification.new do |spec|
10
11
  spec.email = ["jcypret@gmail.com"]
11
12
 
12
13
  spec.summary = "Use Hashids in your Rails app models."
13
- spec.description = <<-EOM
14
+ spec.description = <<-DESCRIPTION
14
15
  This gem allows you to easily use [Hashids](http://hashids.org/ruby/)
15
16
  in your Rails app. Instead of your models using sequential numbers like 1,
16
17
  2, 3, they will instead have unique short hashes like "yLA6m0oM",
17
18
  "5bAyD0LO", and "wz3MZ49l". The database will still use integers under
18
19
  the hood, so this gem can be added or removed at any time.
19
- EOM
20
+ DESCRIPTION
20
21
  spec.homepage = "https://github.com/jcypret/hashid-rails"
21
22
  spec.license = "MIT"
22
23
 
@@ -28,12 +29,12 @@ Gem::Specification.new do |spec|
28
29
  spec.require_paths = ["lib"]
29
30
 
30
31
  spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "byebug"
31
33
  spec.add_development_dependency "rake"
32
34
  spec.add_development_dependency "rspec", "~> 3.4.0"
33
- spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
34
- spec.add_development_dependency "sqlite3"
35
35
  spec.add_development_dependency "rubocop"
36
- spec.add_development_dependency "byebug"
36
+ spec.add_development_dependency "simplecov"
37
+ spec.add_development_dependency "sqlite3"
37
38
 
38
39
  spec.add_runtime_dependency "activerecord", ">= 4.0"
39
40
  spec.add_runtime_dependency "hashids", "~> 1.0"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "hashid/rails/version"
2
4
  require "hashid/rails/configuration"
3
5
  require "hashids"
@@ -38,7 +40,7 @@ module Hashid
38
40
  super.tap { |r| r.extend ClassMethods }
39
41
  end
40
42
 
41
- def has_many(*args, &block) # rubocop:disable Style/PredicateName
43
+ def has_many(*args, &block)
42
44
  options = args.extract_options!
43
45
  options[:extend] = Array(options[:extend]).push(ClassMethods)
44
46
  super(*args, options, &block)
@@ -99,14 +101,16 @@ module Hashid
99
101
  end
100
102
 
101
103
  def hashid_decode(id, fallback:)
102
- decoded_hashid = hashids.decode(id.to_s)
103
104
  fallback_value = fallback ? id : nil
105
+ decoded_hashid = hashids.decode(id.to_s)
104
106
 
105
107
  if Hashid::Rails.configuration.sign_hashids
106
108
  valid_hashid?(decoded_hashid) ? decoded_hashid.last : fallback_value
107
109
  else
108
110
  decoded_hashid.first || fallback_value
109
111
  end
112
+ rescue Hashids::InputError
113
+ fallback_value
110
114
  end
111
115
 
112
116
  def valid_hashid?(decoded_hashid)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hashid
2
4
  module Rails
3
5
  class Configuration
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Hashid
2
4
  module Rails
3
- VERSION = "1.2.1".freeze
5
+ VERSION = "1.2.2"
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashid-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Cypret
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-13 00:00:00.000000000 Z
11
+ date: 2018-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,35 +39,35 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 3.4.0
47
+ version: '0'
48
48
  type: :development
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: 3.4.0
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: codeclimate-test-reporter
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0
61
+ version: 3.4.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.0.0
68
+ version: 3.4.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: sqlite3
70
+ name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop
84
+ name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: byebug
98
+ name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.5.2
186
+ rubygems_version: 2.7.6
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Use Hashids in your Rails app models.