arstotzka 1.4.1 → 1.4.2
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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +8 -3
- data/.rubocop_todo.yml +45 -2
- data/Dockerfile +8 -4
- data/README.md +1 -1
- data/arstotzka.gemspec +16 -10
- data/config/check_specs.yml +6 -0
- data/lib/arstotzka/type_cast.rb +32 -5
- data/lib/arstotzka/version.rb +1 -1
- data/spec/integration/yard/arstotzka/type_cast_spec.rb +8 -1
- data/spec/lib/arstotzka/type_cast_spec.rb +212 -0
- data/spec/support/models/type_caster.rb +1 -0
- metadata +119 -32
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f599cdb12d9866e02b787c3f7655bde7cc48c3eeec67b56587f8d01127ea0cd
|
|
4
|
+
data.tar.gz: e10dffebc13c36d528884a66a4acbff2c36b2a6d1569dd143069d7bc3c7fd86e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba2f99bb1ba971230eead369fcb65e06e939ca006286fbf5a533e392d5af654cd14c46ee9bea19d258c59deff4e6845dc22825e7c6aeff1edd708f733e53c7c6
|
|
7
|
+
data.tar.gz: c9715bb8098c5994e5ba8f753b9337b2955c03d1c348440252e0cd57db3df94b92d87d910a8d87efb6fbbd895d8b0693f47fb4501f2872fb6152b03a53bdbdb0
|
data/.circleci/config.yml
CHANGED
|
@@ -2,7 +2,9 @@ version: 2
|
|
|
2
2
|
jobs:
|
|
3
3
|
build:
|
|
4
4
|
docker:
|
|
5
|
-
- image: darthjee/circleci_ruby_gems:0.
|
|
5
|
+
- image: darthjee/circleci_ruby_gems:0.2.3
|
|
6
|
+
environment:
|
|
7
|
+
PROJECT: arstotzka
|
|
6
8
|
steps:
|
|
7
9
|
- checkout
|
|
8
10
|
- run:
|
|
@@ -25,7 +27,10 @@ jobs:
|
|
|
25
27
|
command: bundle exec rake verify_measurements
|
|
26
28
|
- run:
|
|
27
29
|
name: Check version documentation
|
|
28
|
-
command:
|
|
30
|
+
command: check_readme.sh
|
|
29
31
|
- run:
|
|
30
32
|
name: Rubycritcs check
|
|
31
|
-
command:
|
|
33
|
+
command: rubycritic.sh
|
|
34
|
+
- run:
|
|
35
|
+
name: Check unit tests
|
|
36
|
+
command: check_specs
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,18 +1,61 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2019-
|
|
3
|
+
# on 2019-11-13 14:11:54 +0000 using RuboCop version 0.73.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
+
# Offense count: 55
|
|
10
|
+
# Cop supports --auto-correct.
|
|
11
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
|
12
|
+
# SupportedHashRocketStyles: key, separator, table
|
|
13
|
+
# SupportedColonStyles: key, separator, table
|
|
14
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
|
15
|
+
Layout/AlignHash:
|
|
16
|
+
Exclude:
|
|
17
|
+
- 'lib/arstotzka/config.rb'
|
|
18
|
+
- 'spec/integration/yard/arstotzka/config_spec.rb'
|
|
19
|
+
- 'spec/integration/yard/arstotzka/fetcher_builder_spec.rb'
|
|
20
|
+
- 'spec/integration/yard/arstotzka/fetcher_spec.rb'
|
|
21
|
+
- 'spec/lib/arstotzka/config_spec.rb'
|
|
22
|
+
- 'spec/lib/arstotzka/fetcher_spec.rb'
|
|
23
|
+
- 'spec/lib/arstotzka/options_spec.rb'
|
|
24
|
+
|
|
25
|
+
# Offense count: 13
|
|
26
|
+
# Cop supports --auto-correct.
|
|
27
|
+
Layout/EmptyLineAfterGuardClause:
|
|
28
|
+
Exclude:
|
|
29
|
+
- 'lib/arstotzka/fetcher.rb'
|
|
30
|
+
- 'lib/arstotzka/key_reader.rb'
|
|
31
|
+
- 'lib/arstotzka/options.rb'
|
|
32
|
+
- 'lib/arstotzka/wrapper.rb'
|
|
33
|
+
- 'spec/support/models/arstotzka/dummy.rb'
|
|
34
|
+
- 'spec/support/models/collector/game.rb'
|
|
35
|
+
- 'spec/support/models/customer.rb'
|
|
36
|
+
- 'spec/support/models/drink.rb'
|
|
37
|
+
- 'spec/support/models/employe.rb'
|
|
38
|
+
- 'spec/support/models/person.rb'
|
|
39
|
+
- 'spec/support/models/star.rb'
|
|
40
|
+
- 'spec/support/models/transaction.rb'
|
|
41
|
+
|
|
9
42
|
# Offense count: 1
|
|
43
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
44
|
+
# ExcludedMethods: refine
|
|
45
|
+
Metrics/BlockLength:
|
|
46
|
+
Max: 31
|
|
10
47
|
|
|
11
48
|
# Offense count: 1
|
|
12
49
|
RSpec/AnyInstance:
|
|
13
50
|
Exclude:
|
|
14
51
|
- 'spec/lib/arstotzka/options_spec.rb'
|
|
15
52
|
|
|
16
|
-
# Offense count:
|
|
53
|
+
# Offense count: 78
|
|
17
54
|
RSpec/NestedGroups:
|
|
18
55
|
Max: 5
|
|
56
|
+
|
|
57
|
+
# Offense count: 1
|
|
58
|
+
# Cop supports --auto-correct.
|
|
59
|
+
Style/MultilineWhenThen:
|
|
60
|
+
Exclude:
|
|
61
|
+
- 'lib/arstotzka/hash_reader.rb'
|
data/Dockerfile
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
FROM darthjee/ruby_gems:0.
|
|
2
|
-
FROM darthjee/scripts:0.
|
|
1
|
+
FROM darthjee/ruby_gems:0.2.3 as base
|
|
2
|
+
FROM darthjee/scripts:0.1.2 as scripts
|
|
3
3
|
|
|
4
4
|
######################################
|
|
5
5
|
|
|
6
6
|
FROM base as builder
|
|
7
7
|
|
|
8
8
|
COPY --chown=app ./ /home/app/app/
|
|
9
|
-
COPY --chown=app:app --from=scripts /home/scripts/
|
|
9
|
+
COPY --chown=app:app --from=scripts /home/scripts/builder/bundle_builder.sh /usr/local/sbin/
|
|
10
10
|
|
|
11
11
|
ENV HOME_DIR /home/app
|
|
12
|
-
RUN
|
|
12
|
+
RUN bundle_builder.sh
|
|
13
13
|
|
|
14
14
|
#######################
|
|
15
15
|
#FINAL IMAGE
|
|
16
16
|
FROM base
|
|
17
|
+
RUN mkdir lib/arstotzka -p
|
|
17
18
|
|
|
18
19
|
USER root
|
|
19
20
|
|
|
@@ -23,4 +24,7 @@ COPY --chown=app:app --from=builder /home/app/bundle/specifications /usr/local/b
|
|
|
23
24
|
COPY --chown=app:app --from=builder /home/app/bundle/bin /usr/local/bundle/bin
|
|
24
25
|
COPY --chown=app:app --from=builder /home/app/bundle/extensions /usr/local/bundle/extensions
|
|
25
26
|
|
|
27
|
+
COPY --chown=app ./*.gemspec ./Gemfile /home/app/app/
|
|
28
|
+
COPY --chown=app ./lib/arstotzka/version.rb /home/app/app/lib/arstotzka/
|
|
26
29
|
USER app
|
|
30
|
+
RUN bundle install
|
data/README.md
CHANGED
data/arstotzka.gemspec
CHANGED
|
@@ -22,16 +22,22 @@ Gem::Specification.new do |gem|
|
|
|
22
22
|
gem.add_runtime_dependency 'activesupport', '~> 5.x'
|
|
23
23
|
gem.add_runtime_dependency 'sinclair', '>= 1.4.1'
|
|
24
24
|
|
|
25
|
-
gem.add_development_dependency 'bundler',
|
|
26
|
-
gem.add_development_dependency 'pry
|
|
27
|
-
gem.add_development_dependency '
|
|
28
|
-
gem.add_development_dependency '
|
|
29
|
-
gem.add_development_dependency '
|
|
30
|
-
gem.add_development_dependency '
|
|
31
|
-
gem.add_development_dependency '
|
|
32
|
-
gem.add_development_dependency '
|
|
33
|
-
gem.add_development_dependency '
|
|
34
|
-
gem.add_development_dependency '
|
|
25
|
+
gem.add_development_dependency 'bundler', '~> 1.16.1'
|
|
26
|
+
gem.add_development_dependency 'pry', '0.12.2'
|
|
27
|
+
gem.add_development_dependency 'pry-nav', '0.3.0'
|
|
28
|
+
gem.add_development_dependency 'rake', '12.3.3'
|
|
29
|
+
gem.add_development_dependency 'reek', '5.4.0'
|
|
30
|
+
gem.add_development_dependency 'rspec', '3.8.0'
|
|
31
|
+
gem.add_development_dependency 'rspec-core', '3.8.0'
|
|
32
|
+
gem.add_development_dependency 'rspec-expectations', '3.8.3'
|
|
33
|
+
gem.add_development_dependency 'rspec-mocks', '3.8.0'
|
|
34
|
+
gem.add_development_dependency 'rspec-support', '3.8.0'
|
|
35
|
+
gem.add_development_dependency 'rubocop', '0.73.0'
|
|
36
|
+
gem.add_development_dependency 'rubocop-rspec', '1.33.0'
|
|
37
|
+
gem.add_development_dependency 'rubycritic', '4.1.0'
|
|
38
|
+
gem.add_development_dependency 'simplecov', '0.17.0'
|
|
39
|
+
gem.add_development_dependency 'yard', '0.9.20'
|
|
40
|
+
gem.add_development_dependency 'yardstick', '0.9.9'
|
|
35
41
|
|
|
36
42
|
gem.add_development_dependency 'safe_attribute_assignment'
|
|
37
43
|
end
|
data/lib/arstotzka/type_cast.rb
CHANGED
|
@@ -14,6 +14,7 @@ module Arstotzka
|
|
|
14
14
|
# - integer
|
|
15
15
|
# - string
|
|
16
16
|
# - float
|
|
17
|
+
# - symbol
|
|
17
18
|
#
|
|
18
19
|
# @example (see #to_integer)
|
|
19
20
|
#
|
|
@@ -21,6 +22,8 @@ module Arstotzka
|
|
|
21
22
|
#
|
|
22
23
|
# @example (see #to_float)
|
|
23
24
|
#
|
|
25
|
+
# @example (see #to_symbol)
|
|
26
|
+
#
|
|
24
27
|
# @example Extending typecast
|
|
25
28
|
# class Car
|
|
26
29
|
# attr_reader :model, :maker
|
|
@@ -87,10 +90,10 @@ module Arstotzka
|
|
|
87
90
|
#
|
|
88
91
|
# TypeCaster.new(age: '10').age
|
|
89
92
|
def to_integer(value)
|
|
90
|
-
value.to_i if value.present?
|
|
93
|
+
value.to_s.to_i if value.present?
|
|
91
94
|
end
|
|
92
95
|
|
|
93
|
-
#
|
|
96
|
+
# Converts value to string
|
|
94
97
|
#
|
|
95
98
|
# @return [String]
|
|
96
99
|
#
|
|
@@ -116,7 +119,7 @@ module Arstotzka
|
|
|
116
119
|
value.to_s
|
|
117
120
|
end
|
|
118
121
|
|
|
119
|
-
#
|
|
122
|
+
# Converts value to float
|
|
120
123
|
#
|
|
121
124
|
# @return [Float]
|
|
122
125
|
#
|
|
@@ -124,7 +127,7 @@ module Arstotzka
|
|
|
124
127
|
# class TypeCaster
|
|
125
128
|
# include Arstotzka
|
|
126
129
|
#
|
|
127
|
-
# expose :price,
|
|
130
|
+
# expose :price, type: :float, json: :@hash
|
|
128
131
|
#
|
|
129
132
|
# def initialize(hash)
|
|
130
133
|
# @hash = hash
|
|
@@ -137,7 +140,31 @@ module Arstotzka
|
|
|
137
140
|
#
|
|
138
141
|
# TypeCaster.new(price: '1.75').price # returns 1.75
|
|
139
142
|
def to_float(value)
|
|
140
|
-
value.to_f if value.present?
|
|
143
|
+
value.to_s.to_f if value.present?
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Converts value to Symbol
|
|
147
|
+
#
|
|
148
|
+
# @return [Symbol]
|
|
149
|
+
#
|
|
150
|
+
# @example Casting to Symbol
|
|
151
|
+
# class TypeCaster
|
|
152
|
+
# include Arstotzka
|
|
153
|
+
#
|
|
154
|
+
# expose :type, type: :symbol, json: :@hash
|
|
155
|
+
#
|
|
156
|
+
# def initialize(hash)
|
|
157
|
+
# @hash = hash
|
|
158
|
+
# end
|
|
159
|
+
# end
|
|
160
|
+
#
|
|
161
|
+
# hash = {
|
|
162
|
+
# type: 'type_a'
|
|
163
|
+
# }
|
|
164
|
+
#
|
|
165
|
+
# TypeCaster.new(type: 'type_a').type # returns :type_a
|
|
166
|
+
def to_symbol(value)
|
|
167
|
+
value.to_s.to_sym if value.present?
|
|
141
168
|
end
|
|
142
169
|
end
|
|
143
170
|
end
|
data/lib/arstotzka/version.rb
CHANGED
|
@@ -7,7 +7,8 @@ describe Arstotzka::TypeCast do
|
|
|
7
7
|
{
|
|
8
8
|
age: '10',
|
|
9
9
|
payload: { 'key' => 'value' },
|
|
10
|
-
price: '1.75'
|
|
10
|
+
price: '1.75',
|
|
11
|
+
type: 'type_a'
|
|
11
12
|
}
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -30,6 +31,12 @@ describe Arstotzka::TypeCast do
|
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
|
|
34
|
+
describe 'symbol' do
|
|
35
|
+
it 'converts value to string' do
|
|
36
|
+
expect(model.type).to eq(:type_a)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
33
40
|
describe 'extending' do
|
|
34
41
|
subject(:model) { CarCollector.new(hash) }
|
|
35
42
|
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe Arstotzka::TypeCast do
|
|
4
|
+
subject(:caster) do
|
|
5
|
+
Class.new do
|
|
6
|
+
extend Arstotzka::TypeCast
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
describe '.to_integer' do
|
|
11
|
+
context 'when value is nil' do
|
|
12
|
+
let(:value) {}
|
|
13
|
+
|
|
14
|
+
it { expect(caster.to_integer(value)).to be_nil }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
context 'when value is an integer' do
|
|
18
|
+
let(:value) { 10 }
|
|
19
|
+
|
|
20
|
+
it 'returns the value' do
|
|
21
|
+
expect(caster.to_integer(value)).to eq(value)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it { expect(caster.to_integer(value)).to be_a(Integer) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context 'when value is a string' do
|
|
28
|
+
let(:value) { '10' }
|
|
29
|
+
|
|
30
|
+
it 'returns integer' do
|
|
31
|
+
expect(caster.to_integer(value)).to eq(10)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it { expect(caster.to_integer(value)).to be_a(Integer) }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
context 'when value is an empty string' do
|
|
38
|
+
let(:value) { '' }
|
|
39
|
+
|
|
40
|
+
it { expect(caster.to_integer(value)).to be_nil }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
context 'when value is an invalid string' do
|
|
44
|
+
let(:value) { 'abc' }
|
|
45
|
+
|
|
46
|
+
it { expect(caster.to_integer(value)).to eq(0) }
|
|
47
|
+
|
|
48
|
+
it { expect(caster.to_integer(value)).to be_a(Integer) }
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context 'when value is a symbol' do
|
|
52
|
+
let(:value) { :'10' }
|
|
53
|
+
|
|
54
|
+
it 'returns integer' do
|
|
55
|
+
expect(caster.to_integer(value)).to eq(10)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it { expect(caster.to_integer(value)).to be_a(Integer) }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context 'when value is a float' do
|
|
62
|
+
let(:value) { 10.7 }
|
|
63
|
+
|
|
64
|
+
it 'returns integer rounded down' do
|
|
65
|
+
expect(caster.to_integer(value)).to eq(10)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it { expect(caster.to_integer(value)).to be_a(Integer) }
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '.to_string' do
|
|
73
|
+
context 'when value is nil' do
|
|
74
|
+
let(:value) {}
|
|
75
|
+
|
|
76
|
+
it { expect(caster.to_string(value)).to eq('') }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
context 'when value is a string' do
|
|
80
|
+
let(:value) { 'a' }
|
|
81
|
+
|
|
82
|
+
it 'returns value itself' do
|
|
83
|
+
expect(caster.to_string(value)).to eq(value)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
context 'when value is a symbol' do
|
|
88
|
+
let(:value) { :a }
|
|
89
|
+
|
|
90
|
+
it 'returns converted string' do
|
|
91
|
+
expect(caster.to_string(value)).to eq('a')
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
context 'when value an integer' do
|
|
96
|
+
let(:value) { 10 }
|
|
97
|
+
|
|
98
|
+
it 'returns converted string' do
|
|
99
|
+
expect(caster.to_string(value)).to eq('10')
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
context 'when value a float' do
|
|
104
|
+
let(:value) { 10.5 }
|
|
105
|
+
|
|
106
|
+
it 'returns converted string' do
|
|
107
|
+
expect(caster.to_string(value)).to eq('10.5')
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
describe '.to_float' do
|
|
113
|
+
context 'when value is nil' do
|
|
114
|
+
let(:value) {}
|
|
115
|
+
|
|
116
|
+
it { expect(caster.to_float(value)).to be_nil }
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
context 'when value is an integer' do
|
|
120
|
+
let(:value) { 10 }
|
|
121
|
+
|
|
122
|
+
it 'returns float' do
|
|
123
|
+
expect(caster.to_float(value)).to eq(value)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it { expect(caster.to_float(value)).to be_a(Float) }
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
context 'when value is a string' do
|
|
130
|
+
let(:value) { '10' }
|
|
131
|
+
|
|
132
|
+
it 'returns float' do
|
|
133
|
+
expect(caster.to_float(value)).to eq(10.0)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
it { expect(caster.to_float(value)).to be_a(Float) }
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
context 'when value is an empty string' do
|
|
140
|
+
let(:value) { '' }
|
|
141
|
+
|
|
142
|
+
it { expect(caster.to_float(value)).to be_nil }
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
context 'when value is an invalid string' do
|
|
146
|
+
let(:value) { 'abc' }
|
|
147
|
+
|
|
148
|
+
it { expect(caster.to_float(value)).to eq(0) }
|
|
149
|
+
it { expect(caster.to_float(value)).to be_a(Float) }
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
context 'when value is a symbol' do
|
|
153
|
+
let(:value) { :'10' }
|
|
154
|
+
|
|
155
|
+
it 'returns float' do
|
|
156
|
+
expect(caster.to_float(value)).to eq(10.0)
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it { expect(caster.to_float(value)).to be_a(Float) }
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
context 'when value is a float' do
|
|
163
|
+
let(:value) { 10.7 }
|
|
164
|
+
|
|
165
|
+
it 'returns the value' do
|
|
166
|
+
expect(caster.to_float(value)).to eq(10.7)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
it { expect(caster.to_float(value)).to be_a(Float) }
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
describe '.to_symbol' do
|
|
174
|
+
context 'when value is nil' do
|
|
175
|
+
let(:value) {}
|
|
176
|
+
|
|
177
|
+
it { expect(caster.to_symbol(value)).to be_nil }
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
context 'when value is a string' do
|
|
181
|
+
let(:value) { 'a' }
|
|
182
|
+
|
|
183
|
+
it 'returns symbol' do
|
|
184
|
+
expect(caster.to_symbol(value)).to eq(:a)
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
context 'when value is a symbol' do
|
|
189
|
+
let(:value) { :a }
|
|
190
|
+
|
|
191
|
+
it 'returns value' do
|
|
192
|
+
expect(caster.to_symbol(value)).to eq(value)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
context 'when value an integer' do
|
|
197
|
+
let(:value) { 10 }
|
|
198
|
+
|
|
199
|
+
it 'returns converted symbol' do
|
|
200
|
+
expect(caster.to_symbol(value)).to eq(:'10')
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
context 'when value a float' do
|
|
205
|
+
let(:value) { 10.5 }
|
|
206
|
+
|
|
207
|
+
it 'returns converted symbol' do
|
|
208
|
+
expect(caster.to_symbol(value)).to eq(:'10.5')
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: arstotzka
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.4.
|
|
4
|
+
version: 1.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Darthjee
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -52,130 +52,214 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 1.16.1
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: pry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - '='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.12.2
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - '='
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 0.12.2
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: pry-nav
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
|
-
- -
|
|
73
|
+
- - '='
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.
|
|
75
|
+
version: 0.3.0
|
|
62
76
|
type: :development
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
|
-
- -
|
|
80
|
+
- - '='
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.
|
|
82
|
+
version: 0.3.0
|
|
69
83
|
- !ruby/object:Gem::Dependency
|
|
70
84
|
name: rake
|
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
|
72
86
|
requirements:
|
|
73
|
-
- -
|
|
87
|
+
- - '='
|
|
74
88
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: 12.3.
|
|
89
|
+
version: 12.3.3
|
|
76
90
|
type: :development
|
|
77
91
|
prerelease: false
|
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
93
|
requirements:
|
|
80
|
-
- -
|
|
94
|
+
- - '='
|
|
81
95
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 12.3.
|
|
96
|
+
version: 12.3.3
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: reek
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - '='
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 5.4.0
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - '='
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 5.4.0
|
|
83
111
|
- !ruby/object:Gem::Dependency
|
|
84
112
|
name: rspec
|
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
|
86
114
|
requirements:
|
|
87
|
-
- -
|
|
115
|
+
- - '='
|
|
88
116
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
117
|
+
version: 3.8.0
|
|
90
118
|
type: :development
|
|
91
119
|
prerelease: false
|
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
121
|
requirements:
|
|
94
|
-
- -
|
|
122
|
+
- - '='
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 3.8.0
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: rspec-core
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - '='
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: 3.8.0
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - '='
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: 3.8.0
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rspec-expectations
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - '='
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: 3.8.3
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - '='
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: 3.8.3
|
|
153
|
+
- !ruby/object:Gem::Dependency
|
|
154
|
+
name: rspec-mocks
|
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
|
156
|
+
requirements:
|
|
157
|
+
- - '='
|
|
158
|
+
- !ruby/object:Gem::Version
|
|
159
|
+
version: 3.8.0
|
|
160
|
+
type: :development
|
|
161
|
+
prerelease: false
|
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
163
|
+
requirements:
|
|
164
|
+
- - '='
|
|
95
165
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
166
|
+
version: 3.8.0
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: rspec-support
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - '='
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: 3.8.0
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - '='
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: 3.8.0
|
|
97
181
|
- !ruby/object:Gem::Dependency
|
|
98
182
|
name: rubocop
|
|
99
183
|
requirement: !ruby/object:Gem::Requirement
|
|
100
184
|
requirements:
|
|
101
185
|
- - '='
|
|
102
186
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 0.
|
|
187
|
+
version: 0.73.0
|
|
104
188
|
type: :development
|
|
105
189
|
prerelease: false
|
|
106
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
191
|
requirements:
|
|
108
192
|
- - '='
|
|
109
193
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.
|
|
194
|
+
version: 0.73.0
|
|
111
195
|
- !ruby/object:Gem::Dependency
|
|
112
196
|
name: rubocop-rspec
|
|
113
197
|
requirement: !ruby/object:Gem::Requirement
|
|
114
198
|
requirements:
|
|
115
199
|
- - '='
|
|
116
200
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 1.
|
|
201
|
+
version: 1.33.0
|
|
118
202
|
type: :development
|
|
119
203
|
prerelease: false
|
|
120
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
205
|
requirements:
|
|
122
206
|
- - '='
|
|
123
207
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 1.
|
|
208
|
+
version: 1.33.0
|
|
125
209
|
- !ruby/object:Gem::Dependency
|
|
126
210
|
name: rubycritic
|
|
127
211
|
requirement: !ruby/object:Gem::Requirement
|
|
128
212
|
requirements:
|
|
129
|
-
- -
|
|
213
|
+
- - '='
|
|
130
214
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: 4.0
|
|
215
|
+
version: 4.1.0
|
|
132
216
|
type: :development
|
|
133
217
|
prerelease: false
|
|
134
218
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
219
|
requirements:
|
|
136
|
-
- -
|
|
220
|
+
- - '='
|
|
137
221
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: 4.0
|
|
222
|
+
version: 4.1.0
|
|
139
223
|
- !ruby/object:Gem::Dependency
|
|
140
224
|
name: simplecov
|
|
141
225
|
requirement: !ruby/object:Gem::Requirement
|
|
142
226
|
requirements:
|
|
143
|
-
- -
|
|
227
|
+
- - '='
|
|
144
228
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: 0.
|
|
229
|
+
version: 0.17.0
|
|
146
230
|
type: :development
|
|
147
231
|
prerelease: false
|
|
148
232
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
233
|
requirements:
|
|
150
|
-
- -
|
|
234
|
+
- - '='
|
|
151
235
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: 0.
|
|
236
|
+
version: 0.17.0
|
|
153
237
|
- !ruby/object:Gem::Dependency
|
|
154
238
|
name: yard
|
|
155
239
|
requirement: !ruby/object:Gem::Requirement
|
|
156
240
|
requirements:
|
|
157
|
-
- -
|
|
241
|
+
- - '='
|
|
158
242
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 0.9.
|
|
243
|
+
version: 0.9.20
|
|
160
244
|
type: :development
|
|
161
245
|
prerelease: false
|
|
162
246
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
247
|
requirements:
|
|
164
|
-
- -
|
|
248
|
+
- - '='
|
|
165
249
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 0.9.
|
|
250
|
+
version: 0.9.20
|
|
167
251
|
- !ruby/object:Gem::Dependency
|
|
168
252
|
name: yardstick
|
|
169
253
|
requirement: !ruby/object:Gem::Requirement
|
|
170
254
|
requirements:
|
|
171
|
-
- -
|
|
255
|
+
- - '='
|
|
172
256
|
- !ruby/object:Gem::Version
|
|
173
257
|
version: 0.9.9
|
|
174
258
|
type: :development
|
|
175
259
|
prerelease: false
|
|
176
260
|
version_requirements: !ruby/object:Gem::Requirement
|
|
177
261
|
requirements:
|
|
178
|
-
- -
|
|
262
|
+
- - '='
|
|
179
263
|
- !ruby/object:Gem::Version
|
|
180
264
|
version: 0.9.9
|
|
181
265
|
- !ruby/object:Gem::Dependency
|
|
@@ -213,6 +297,7 @@ files:
|
|
|
213
297
|
- Rakefile
|
|
214
298
|
- arstotzka.gemspec
|
|
215
299
|
- arstotzka.jpg
|
|
300
|
+
- config/check_specs.yml
|
|
216
301
|
- config/rubycritc.rb
|
|
217
302
|
- config/yardstick.rb
|
|
218
303
|
- config/yardstick.yml
|
|
@@ -274,6 +359,7 @@ files:
|
|
|
274
359
|
- spec/lib/arstotzka/options_spec.rb
|
|
275
360
|
- spec/lib/arstotzka/post_processor_spec.rb
|
|
276
361
|
- spec/lib/arstotzka/reader_spec.rb
|
|
362
|
+
- spec/lib/arstotzka/type_cast_spec.rb
|
|
277
363
|
- spec/lib/arstotzka/wrapper_spec.rb
|
|
278
364
|
- spec/lib/arstotzka_spec.rb
|
|
279
365
|
- spec/spec_helper.rb
|
|
@@ -374,6 +460,7 @@ test_files:
|
|
|
374
460
|
- spec/lib/arstotzka/options_spec.rb
|
|
375
461
|
- spec/lib/arstotzka/post_processor_spec.rb
|
|
376
462
|
- spec/lib/arstotzka/reader_spec.rb
|
|
463
|
+
- spec/lib/arstotzka/type_cast_spec.rb
|
|
377
464
|
- spec/lib/arstotzka/wrapper_spec.rb
|
|
378
465
|
- spec/lib/arstotzka_spec.rb
|
|
379
466
|
- spec/spec_helper.rb
|