opto 1.8.1 → 1.8.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
2
  SHA1:
3
- metadata.gz: 6025b403553a3ecfb777534995962166273d72be
4
- data.tar.gz: a947fa23c88021c9f83eba1e925d478bcaf44dae
3
+ metadata.gz: f08a0ec227631377b328f07f87e3b0ff2f1e2def
4
+ data.tar.gz: 3af3a7c0077be8a24f304789a14dfbc970162e0e
5
5
  SHA512:
6
- metadata.gz: e16e7b5ca1c943dbeb4df9da7c40196f9f6eb5e85fcc02e18985be15c301c748bd30218377e9088a5a0dd096a7ea10e01cec6abfbe72d5a04a4f1f1c41a693d6
7
- data.tar.gz: 7bc3b7d16d8cc8f88a259049509086dc652e1195cc54b60ee744393d14eb91e8845f89ae9428b3aca6cc73a28cc314c31b0239f0d54f6f7bfabd3d0394f02d5f
6
+ metadata.gz: eb8f310f22ded339e110e98ca00d01f4f2922307ca3697b7c1dd4e989183fd160a3ecd123238d6abe0a9ca1d72981e001e1eb2ae2050f69cdb51ef76a35a81c7
7
+ data.tar.gz: c6472dfea318ad51b7c85148d66b63580216266d08fe0250ff1f1638a11033272635c47480bd872eb40af19c9b573507ad83a4c6c4d9a8ea758a8a2557a2d911
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.8
3
+ - 2.1.10
4
4
  - 2.2.3
5
5
  - 2.3.3
6
6
  - 2.4.0
@@ -16,7 +16,7 @@ module Opto
16
16
  using Opto::Extension::HashStringOrSymbolKey
17
17
 
18
18
 
19
- OPTIONS = {
19
+ OPTIONS ||= {
20
20
  split: ',',
21
21
  join: false,
22
22
  empty_is_nil: false,
@@ -16,7 +16,7 @@ module Opto
16
16
  class Boolean < Opto::Type
17
17
  using Opto::Extension::HashStringOrSymbolKey
18
18
 
19
- OPTIONS = {
19
+ OPTIONS ||= {
20
20
  truthy: ['true', 'yes', '1', 'on', 'enabled', 'enable'],
21
21
  nil_is: false,
22
22
  blank_is: false,
@@ -1,7 +1,6 @@
1
1
  require_relative '../type'
2
2
  require 'opto/extensions/snake_case'
3
3
  require 'opto/extensions/hash_string_or_symbol_key'
4
- require 'opto/types/boolean'
5
4
 
6
5
  module Opto
7
6
  module Types
@@ -37,14 +36,14 @@ module Opto
37
36
  class Enum < Opto::Type
38
37
  using Opto::Extension::HashStringOrSymbolKey
39
38
 
40
- OPTIONS = {
39
+ OPTIONS ||= {
41
40
  options: [],
42
41
  can_be_other: false,
43
42
  in: []
44
43
  }
45
44
 
46
45
  true_when do |value|
47
- Opto::Types::Boolean.new(options).sanitize_to_bool(value)
46
+ !value.nil?
48
47
  end
49
48
 
50
49
  def initialize(options={})
@@ -13,7 +13,7 @@ module Opto
13
13
  class Integer < Opto::Type
14
14
  using Opto::Extension::HashStringOrSymbolKey
15
15
 
16
- OPTIONS = {
16
+ OPTIONS ||= {
17
17
  min: 0,
18
18
  max: nil,
19
19
  nil_is_zero: false
@@ -2,7 +2,6 @@ require_relative '../type'
2
2
  require 'base64'
3
3
  require 'opto/extensions/snake_case'
4
4
  require 'opto/extensions/hash_string_or_symbol_key'
5
- require 'opto/types/boolean'
6
5
 
7
6
  module Opto
8
7
  module Types
@@ -25,7 +24,7 @@ module Opto
25
24
 
26
25
  TRANSFORMATIONS = [ :upcase, :downcase, :strip, :chomp, :capitalize ]
27
26
 
28
- OPTIONS = {
27
+ OPTIONS ||= {
29
28
  min_length: nil,
30
29
  max_length: nil,
31
30
  empty_is_nil: true,
@@ -12,7 +12,7 @@ module Opto
12
12
  class Uri < Opto::Type
13
13
  using Opto::Extension::HashStringOrSymbolKey
14
14
 
15
- OPTIONS = {
15
+ OPTIONS ||= {
16
16
  schemes: [ 'http', 'https' ]
17
17
  }
18
18
 
data/lib/opto/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Opto
2
- VERSION = "1.8.1"
2
+ VERSION = "1.8.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kimmo Lehto