simple_validate 1.2.2 → 1.2.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
- SHA1:
3
- metadata.gz: '088622398860ce0640092a27f1f6a20cf1c6888f'
4
- data.tar.gz: 97156629872295a0d1b1134a0d27467b74568a12
2
+ SHA256:
3
+ metadata.gz: 4a55b4307e3f7b02f9caf048c5e892bf4230100557460d58df45b28dab196a68
4
+ data.tar.gz: 54faeafbe20dc26a0ec96e6d087fa04195ea0efdf6593fcd28a356fc4decc8b7
5
5
  SHA512:
6
- metadata.gz: bbd5436dee6f843d1c1759fe509271204ed4bd87f7c268a90c6930f345c41d6c8c8cbde5604d3d903fa33958fcecda0169007223e378a3cb1fee4bec43b0db3b
7
- data.tar.gz: 0f863a046f6dbec9e8c311b3feb2a1019b4945f607743e3755dfba02c570bfb0c93d2c9cc619d7c8ad9f607943abc4ec188bb647e15ec8c59b6efb5205c6f327
6
+ metadata.gz: 1dab29ca30408fd05ca35e81fe8e7fc7db0029b5622369a7bbc89d9a3b8a85c92947a5c423ac0d2494c52f933569bc4ae96328cf3ed0a9ae87a422627719b400
7
+ data.tar.gz: 3c78f456e17d56a3649e4bde7475a32a084de618676bb0318c230f0572e6a727271f9afefcbc8d3f47beeda49bf7bdf16a10f1dd4d1efb43563db2330b0b1cfb
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gem 'rake'
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
  require 'rubocop/rake_task'
@@ -5,4 +7,4 @@ require 'rubocop/rake_task'
5
7
  RSpec::Core::RakeTask.new(:spec)
6
8
  RuboCop::RakeTask.new
7
9
 
8
- task default: %i[spec rubocop]
10
+ task default: %i[spec rubocop:auto_correct]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  %w[base
2
4
  presence_of
3
5
  format_of
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class Errors
3
5
  attr_reader :messages
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesBase
3
5
  attr_accessor :message, :attribute, :condition
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesExclusionOf < ValidatesSetBase
3
5
  def valid?(instance)
4
6
  raise ArgumentError if set.empty? || !options.fetch(:in).is_a?(Array)
7
+
5
8
  !set.include?(instance.send(attribute).to_s)
6
9
  end
7
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesFormatOf < ValidatesBase
3
5
  attr_accessor :regex
@@ -10,6 +12,7 @@ module SimpleValidate
10
12
 
11
13
  def valid?(instance)
12
14
  raise ArgumentError if regex.nil? || !regex.is_a?(Regexp)
15
+
13
16
  !!(instance.send(attribute) =~ regex)
14
17
  end
15
18
  end
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesInclusionOf < ValidatesSetBase
3
5
  def valid?(instance)
4
6
  raise ArgumentError if set.empty? || !options.fetch(:in).is_a?(Array)
7
+
5
8
  set.include?(instance.send(attribute).to_s)
6
9
  end
7
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesLengthOf < ValidatesBase
3
5
  class InvalidLengthOption < ArgumentError; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesNumericalityOf < ValidatesBase
3
5
  def initialize(attribute, options)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
4
  class ValidatesPresenceOf < ValidatesBase
3
5
  def initialize(attribute, options)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
5
  module SimpleValidate
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module SimpleValidate
2
- VERSION = '1.2.2'.freeze
4
+ VERSION = '1.2.3'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'simple_validate/version'
@@ -18,6 +20,6 @@ Gem::Specification.new do |spec|
18
20
  end
19
21
 
20
22
  spec.require_paths = ['lib']
21
- spec.add_dependency 'activesupport', '~> 5.0'
23
+ spec.add_dependency 'activesupport'
22
24
  spec.add_development_dependency 'bundler'
23
25
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_validate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Palaniuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-01 00:00:00.000000000 Z
11
+ date: 2020-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
87
- rubyforge_project:
88
- rubygems_version: 2.6.13
87
+ rubygems_version: 3.0.3
89
88
  signing_key:
90
89
  specification_version: 4
91
90
  summary: Validations for any plain old ruby object