necromancer 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/necromancer.rb +4 -3
  4. data/lib/necromancer/context.rb +4 -4
  5. data/lib/necromancer/conversion_target.rb +5 -5
  6. data/lib/necromancer/conversions.rb +10 -10
  7. data/lib/necromancer/converter.rb +1 -1
  8. data/lib/necromancer/converters/array.rb +6 -6
  9. data/lib/necromancer/converters/boolean.rb +2 -2
  10. data/lib/necromancer/converters/date_time.rb +4 -4
  11. data/lib/necromancer/converters/numeric.rb +7 -7
  12. data/lib/necromancer/converters/range.rb +6 -6
  13. data/lib/necromancer/null_converter.rb +1 -1
  14. data/lib/necromancer/version.rb +1 -1
  15. metadata +9 -77
  16. data/Rakefile +0 -8
  17. data/necromancer.gemspec +0 -34
  18. data/spec/spec_helper.rb +0 -53
  19. data/spec/unit/can_spec.rb +0 -9
  20. data/spec/unit/config_spec.rb +0 -30
  21. data/spec/unit/configuration/new_spec.rb +0 -28
  22. data/spec/unit/conversions/fetch_spec.rb +0 -16
  23. data/spec/unit/conversions/register_spec.rb +0 -58
  24. data/spec/unit/conversions/to_hash_spec.rb +0 -37
  25. data/spec/unit/convert_spec.rb +0 -130
  26. data/spec/unit/converters/array/array_to_boolean_spec.rb +0 -20
  27. data/spec/unit/converters/array/array_to_numeric_spec.rb +0 -20
  28. data/spec/unit/converters/array/array_to_set_spec.rb +0 -16
  29. data/spec/unit/converters/array/object_to_array_spec.rb +0 -19
  30. data/spec/unit/converters/array/string_to_array_spec.rb +0 -31
  31. data/spec/unit/converters/boolean/boolean_to_integer_spec.rb +0 -24
  32. data/spec/unit/converters/boolean/integer_to_boolean_spec.rb +0 -20
  33. data/spec/unit/converters/boolean/string_to_boolean_spec.rb +0 -34
  34. data/spec/unit/converters/date_time/string_to_date_spec.rb +0 -24
  35. data/spec/unit/converters/date_time/string_to_datetime_spec.rb +0 -30
  36. data/spec/unit/converters/date_time/string_to_time_spec.rb +0 -28
  37. data/spec/unit/converters/numeric/string_to_float_spec.rb +0 -46
  38. data/spec/unit/converters/numeric/string_to_integer_spec.rb +0 -60
  39. data/spec/unit/converters/numeric/string_to_numeric_spec.rb +0 -30
  40. data/spec/unit/converters/range/string_to_range_spec.rb +0 -33
  41. data/spec/unit/inspect_spec.rb +0 -14
  42. data/spec/unit/new_spec.rb +0 -10
  43. data/spec/unit/register_spec.rb +0 -15
  44. data/tasks/console.rake +0 -11
  45. data/tasks/coverage.rake +0 -11
  46. data/tasks/spec.rake +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2c75ba263712a00a1285f1fd8ae475b707c399274e16ba0fba2cb3530d5e4fa
4
- data.tar.gz: 81d2facadf014a876d53b723153d07ca6c71e2160b91de158f8932434a02c851
3
+ metadata.gz: 68eb8e7721b9b177485217e74aecb8e9c9bbe2995615bdb21d2601c04afe2bb2
4
+ data.tar.gz: d80270564204a03b60dacfc21c0e4da9283a0c387bef4fe1566829e9bce9bd54
5
5
  SHA512:
6
- metadata.gz: b1e756209c25b089ac91855e03f54d7ca455e429059eb9cce5ce1ffa5923701b49803bee61eaae79740aa1aee1d9dcdb7468c959cd17e5b146e054f7177b563c
7
- data.tar.gz: ab17c590fc92c5206a0b961af955f48314cb7b7d5739cab04e8ec5a09e011f088f468c3b0ccc7a8e95673b0a978f1cedc034ed2d1f899077549bedf3c40051e8
6
+ metadata.gz: 5638c5411b0f5a2f4b2fe59d78ef59c59a4c0de675989c8c3fe40b6694f02b11ecb87f8294e1cc9147e17efcc6c7b906f9cbb23caa75e4b21c32e48607b01a08
7
+ data.tar.gz: b89a52e45e1aab9d36121a7ef17aba54436bdb3fa58182df77808d57cb146e0688cb05e335b6464b6d66bf396bf579fbe61ea0ecb9abdac59ed9d80cbf992f26
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.6.0] - 2020-03-08
4
+
5
+ ### Changed
6
+ * Change gemspec to remove test artifacts
7
+
3
8
  ## [v0.5.1] - 2019-11-24
4
9
 
5
10
  ### Changed
@@ -52,6 +57,7 @@
52
57
 
53
58
  * Initial implementation and release
54
59
 
60
+ [v0.6.0]: https://github.com/piotrmurach/necromancer/compare/v0.5.1...v0.6.0
55
61
  [v0.5.1]: https://github.com/piotrmurach/necromancer/compare/v0.5.0...v0.5.1
56
62
  [v0.5.0]: https://github.com/piotrmurach/necromancer/compare/v0.4.0...v0.5.0
57
63
  [v0.4.0]: https://github.com/piotrmurach/necromancer/compare/v0.3.0...v0.4.0
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'necromancer/context'
4
- require_relative 'necromancer/version'
3
+ require_relative "necromancer/context"
4
+ require_relative "necromancer/version"
5
5
 
6
6
  module Necromancer
7
7
  # Raised when cannot conver to a given type
@@ -26,7 +26,8 @@ module Necromancer
26
26
  # Convenience to directly call conversion
27
27
  #
28
28
  # @example
29
- # Necromancer.convert('1').to(:integer)
29
+ # Necromancer.convert("1").to(:integer)
30
+ # # => 1
30
31
  #
31
32
  # @return [ConversionTarget]
32
33
  #
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'forwardable'
3
+ require "forwardable"
4
4
 
5
- require_relative 'configuration'
6
- require_relative 'conversions'
7
- require_relative 'conversion_target'
5
+ require_relative "configuration"
6
+ require_relative "conversions"
7
+ require_relative "conversion_target"
8
8
 
9
9
  module Necromancer
10
10
  # A class used by Necromancer to provide user interace
@@ -20,12 +20,12 @@ module Necromancer
20
20
  if UndefinedValue.equal?(value)
21
21
  unless block
22
22
  raise ArgumentError,
23
- 'You need to pass either argument or a block to `convert`.'
23
+ "You need to pass either argument or a block to `convert`."
24
24
  end
25
25
  new(context, block.call)
26
26
  elsif block
27
27
  raise ArgumentError,
28
- 'You cannot pass both an argument and a block to `convert`.'
28
+ "You cannot pass both an argument and a block to `convert`."
29
29
  else
30
30
  new(context, value)
31
31
  end
@@ -34,7 +34,7 @@ module Necromancer
34
34
  # Allows to specify conversion source type
35
35
  #
36
36
  # @example
37
- # converter.convert('1').from(:string).to(:numeric) # => 1
37
+ # converter.convert("1").from(:string).to(:numeric) # => 1
38
38
  #
39
39
  # @return [ConversionType]
40
40
  #
@@ -47,10 +47,10 @@ module Necromancer
47
47
  # Runs a given conversion
48
48
  #
49
49
  # @example
50
- # converter.convert('1').to(:numeric) # => 1
50
+ # converter.convert("1").to(:numeric) # => 1
51
51
  #
52
52
  # @example
53
- # converter.convert('1') >> Integer # => 1
53
+ # converter.convert("1") >> Integer # => 1
54
54
  #
55
55
  # @return [Object]
56
56
  # the converted target type
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'configuration'
4
- require_relative 'converter'
5
- require_relative 'converters/array'
6
- require_relative 'converters/boolean'
7
- require_relative 'converters/date_time'
8
- require_relative 'converters/numeric'
9
- require_relative 'converters/range'
3
+ require_relative "configuration"
4
+ require_relative "converter"
5
+ require_relative "converters/array"
6
+ require_relative "converters/boolean"
7
+ require_relative "converters/date_time"
8
+ require_relative "converters/numeric"
9
+ require_relative "converters/range"
10
10
 
11
11
  module Necromancer
12
12
  # Represents the context used to configure various converters
@@ -14,7 +14,7 @@ module Necromancer
14
14
  #
15
15
  # @api public
16
16
  class Conversions
17
- DELIMITER = '->'.freeze
17
+ DELIMITER = "->"
18
18
 
19
19
  # Creates a new conversions map
20
20
  #
@@ -101,8 +101,8 @@ module Necromancer
101
101
  # @api private
102
102
  def generate_key(converter)
103
103
  parts = []
104
- parts << (converter.source ? converter.source.to_s : 'none')
105
- parts << (converter.target ? converter.target.to_s : 'none')
104
+ parts << (converter.source ? converter.source.to_s : "none")
105
+ parts << (converter.target ? converter.target.to_s : "none")
106
106
  parts.join(DELIMITER)
107
107
  end
108
108
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'configuration'
3
+ require_relative "configuration"
4
4
 
5
5
  module Necromancer
6
6
  # Abstract converter used internally as a base for other converters
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'set'
3
+ require "set"
4
4
 
5
- require_relative '../converter'
5
+ require_relative "../converter"
6
6
 
7
7
  module Necromancer
8
8
  # Container for Array converter classes
@@ -12,10 +12,10 @@ module Necromancer
12
12
  # Convert string value to array
13
13
  #
14
14
  # @example
15
- # converter.call('a, b, c') # => ['a', 'b', 'c']
15
+ # converter.call("a, b, c") # => ["a", "b", "c"]
16
16
  #
17
17
  # @example
18
- # converter.call('1 - 2 - 3') # => [1, 2, 3]
18
+ # converter.call("1 - 2 - 3") # => [1, 2, 3]
19
19
  #
20
20
  # @api public
21
21
  def call(value, options = {})
@@ -36,7 +36,7 @@ module Necromancer
36
36
  # Convert an array to an array of numeric values
37
37
  #
38
38
  # @example
39
- # converter.call(['1', '2.3', '3.0]) # => [1, 2.3, 3.0]
39
+ # converter.call(["1", "2.3", "3.0]) # => [1, 2.3, 3.0]
40
40
  #
41
41
  # @param [Array] value
42
42
  # the value to convert
@@ -53,7 +53,7 @@ module Necromancer
53
53
  # An object that converts an array to an array with boolean values
54
54
  class ArrayToBooleanConverter < Converter
55
55
  # @example
56
- # converter.call(['t', 'f', 'yes', 'no']) # => [true, false, true, false]
56
+ # converter.call(["t", "f", "yes", "no"]) # => [true, false, true, false]
57
57
  #
58
58
  # @param [Array] value
59
59
  # the array value to boolean
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../converter'
4
- require_relative '../null_converter'
3
+ require_relative "../converter"
4
+ require_relative "../null_converter"
5
5
 
6
6
  module Necromancer
7
7
  # Container for Boolean converter classes
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'date'
4
- require 'time'
3
+ require "date"
4
+ require "time"
5
5
 
6
- require_relative '../converter'
7
- require_relative '../null_converter'
6
+ require_relative "../converter"
7
+ require_relative "../null_converter"
8
8
 
9
9
  module Necromancer
10
10
  # Container for Date converter classes
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../converter'
4
- require_relative '../null_converter'
3
+ require_relative "../converter"
4
+ require_relative "../null_converter"
5
5
 
6
6
  module Necromancer
7
7
  # Container for Numeric converter classes
@@ -15,7 +15,7 @@ module Necromancer
15
15
  # Convert string value to integer
16
16
  #
17
17
  # @example
18
- # converter.call('1abc') # => 1
18
+ # converter.call("1abc") # => 1
19
19
  #
20
20
  # @api public
21
21
  def call(value, **options)
@@ -31,7 +31,7 @@ module Necromancer
31
31
  # Convert integer value to string
32
32
  #
33
33
  # @example
34
- # converter.call(1) # => '1'
34
+ # converter.call(1) # => "1"
35
35
  #
36
36
  # @api public
37
37
  def call(value, **_)
@@ -44,7 +44,7 @@ module Necromancer
44
44
  # Convert string to float value
45
45
  #
46
46
  # @example
47
- # converter.call('1.2') # => 1.2
47
+ # converter.call("1.2") # => 1.2
48
48
  #
49
49
  # @api public
50
50
  def call(value, **options)
@@ -60,10 +60,10 @@ module Necromancer
60
60
  # Convert string to numeric value
61
61
  #
62
62
  # @example
63
- # converter.call('1.0') # => 1.0
63
+ # converter.call("1.0") # => 1.0
64
64
  #
65
65
  # @example
66
- # converter.call('1') # => 1
66
+ # converter.call("1") # => 1
67
67
  #
68
68
  # @api public
69
69
  def call(value, **options)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../converter'
4
- require_relative '../null_converter'
3
+ require_relative "../converter"
4
+ require_relative "../null_converter"
5
5
 
6
6
  module Necromancer
7
7
  # Container for Range converter classes
@@ -19,10 +19,10 @@ module Necromancer
19
19
  # @param [Object] value
20
20
  #
21
21
  # @example
22
- # converter.call('0,9') # => (0..9)
22
+ # converter.call("0,9") # => (0..9)
23
23
  #
24
24
  # @example
25
- # converter.call('0-9') # => (0..9)
25
+ # converter.call("0-9") # => (0..9)
26
26
  #
27
27
  # @api public
28
28
  def call(value, options = {})
@@ -31,9 +31,9 @@ module Necromancer
31
31
  when SINGLE_DIGIT_MATCHER
32
32
  ::Range.new($1.to_i, $1.to_i)
33
33
  when DIGIT_MATCHER
34
- ::Range.new($1.to_i, $3.to_i, $2 == '...')
34
+ ::Range.new($1.to_i, $3.to_i, $2 == "...")
35
35
  when LETTER_MATCHER
36
- ::Range.new($1.to_s, $3.to_s, $2 == '...')
36
+ ::Range.new($1.to_s, $3.to_s, $2 == "...")
37
37
  else
38
38
  strict ? raise_conversion_type(value) : value
39
39
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'converter'
3
+ require_relative "converter"
4
4
 
5
5
  module Necromancer
6
6
  # A pass through converter
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Necromancer
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end # Necromancer
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: necromancer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-24 00:00:00.000000000 Z
11
+ date: 2020-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.6'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '1.6'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -54,15 +40,17 @@ dependencies:
54
40
  version: '3.0'
55
41
  description: Conversion from one object type to another with a bit of black magic.
56
42
  email:
57
- - me@piotrmurach.com
43
+ - piotr@piotrmurach.com
58
44
  executables: []
59
45
  extensions: []
60
- extra_rdoc_files: []
46
+ extra_rdoc_files:
47
+ - README.md
48
+ - CHANGELOG.md
49
+ - LICENSE.txt
61
50
  files:
62
51
  - CHANGELOG.md
63
52
  - LICENSE.txt
64
53
  - README.md
65
- - Rakefile
66
54
  - lib/necromancer.rb
67
55
  - lib/necromancer/configuration.rb
68
56
  - lib/necromancer/context.rb
@@ -76,36 +64,6 @@ files:
76
64
  - lib/necromancer/converters/range.rb
77
65
  - lib/necromancer/null_converter.rb
78
66
  - lib/necromancer/version.rb
79
- - necromancer.gemspec
80
- - spec/spec_helper.rb
81
- - spec/unit/can_spec.rb
82
- - spec/unit/config_spec.rb
83
- - spec/unit/configuration/new_spec.rb
84
- - spec/unit/conversions/fetch_spec.rb
85
- - spec/unit/conversions/register_spec.rb
86
- - spec/unit/conversions/to_hash_spec.rb
87
- - spec/unit/convert_spec.rb
88
- - spec/unit/converters/array/array_to_boolean_spec.rb
89
- - spec/unit/converters/array/array_to_numeric_spec.rb
90
- - spec/unit/converters/array/array_to_set_spec.rb
91
- - spec/unit/converters/array/object_to_array_spec.rb
92
- - spec/unit/converters/array/string_to_array_spec.rb
93
- - spec/unit/converters/boolean/boolean_to_integer_spec.rb
94
- - spec/unit/converters/boolean/integer_to_boolean_spec.rb
95
- - spec/unit/converters/boolean/string_to_boolean_spec.rb
96
- - spec/unit/converters/date_time/string_to_date_spec.rb
97
- - spec/unit/converters/date_time/string_to_datetime_spec.rb
98
- - spec/unit/converters/date_time/string_to_time_spec.rb
99
- - spec/unit/converters/numeric/string_to_float_spec.rb
100
- - spec/unit/converters/numeric/string_to_integer_spec.rb
101
- - spec/unit/converters/numeric/string_to_numeric_spec.rb
102
- - spec/unit/converters/range/string_to_range_spec.rb
103
- - spec/unit/inspect_spec.rb
104
- - spec/unit/new_spec.rb
105
- - spec/unit/register_spec.rb
106
- - tasks/console.rake
107
- - tasks/coverage.rake
108
- - tasks/spec.rake
109
67
  homepage: https://github.com/piotrmurach/necromancer
110
68
  licenses:
111
69
  - MIT
@@ -130,34 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
88
  - !ruby/object:Gem::Version
131
89
  version: '0'
132
90
  requirements: []
133
- rubygems_version: 3.0.6
91
+ rubygems_version: 3.1.2
134
92
  signing_key:
135
93
  specification_version: 4
136
94
  summary: Conversion from one object type to another with a bit of black magic.
137
- test_files:
138
- - spec/spec_helper.rb
139
- - spec/unit/can_spec.rb
140
- - spec/unit/config_spec.rb
141
- - spec/unit/configuration/new_spec.rb
142
- - spec/unit/conversions/fetch_spec.rb
143
- - spec/unit/conversions/register_spec.rb
144
- - spec/unit/conversions/to_hash_spec.rb
145
- - spec/unit/convert_spec.rb
146
- - spec/unit/converters/array/array_to_boolean_spec.rb
147
- - spec/unit/converters/array/array_to_numeric_spec.rb
148
- - spec/unit/converters/array/array_to_set_spec.rb
149
- - spec/unit/converters/array/object_to_array_spec.rb
150
- - spec/unit/converters/array/string_to_array_spec.rb
151
- - spec/unit/converters/boolean/boolean_to_integer_spec.rb
152
- - spec/unit/converters/boolean/integer_to_boolean_spec.rb
153
- - spec/unit/converters/boolean/string_to_boolean_spec.rb
154
- - spec/unit/converters/date_time/string_to_date_spec.rb
155
- - spec/unit/converters/date_time/string_to_datetime_spec.rb
156
- - spec/unit/converters/date_time/string_to_time_spec.rb
157
- - spec/unit/converters/numeric/string_to_float_spec.rb
158
- - spec/unit/converters/numeric/string_to_integer_spec.rb
159
- - spec/unit/converters/numeric/string_to_numeric_spec.rb
160
- - spec/unit/converters/range/string_to_range_spec.rb
161
- - spec/unit/inspect_spec.rb
162
- - spec/unit/new_spec.rb
163
- - spec/unit/register_spec.rb
95
+ test_files: []
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- require 'bundler/gem_tasks'
2
-
3
- FileList['tasks/**/*.rake'].each(&method(:import))
4
-
5
- desc 'Run all specs'
6
- task ci: %w[ spec ]
7
-
8
- task default: :spec