aaaa_aaaa 0.0.1 → 0.0.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/lib/aaaa_aaaa.rb +10 -3
- data/lib/aaaa_aaaa/version.rb +1 -1
- data/spec/aaaa_aaaa_spec.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62b1d38308f52d72dad9cddd75ddced11f7730ab
|
4
|
+
data.tar.gz: b846b4a622282b6a4d403d46b77b4f71375ba12b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7d9372f905dc7ed9b3bd2e7318c99aac5ac75a1c28cc4dae8aa269963565b1ecdf2357046533626ca7d16e340cb6222cccd6f16050966c1330d2c58dbb1762f
|
7
|
+
data.tar.gz: 5b8832d12e05430859fd642765422eab703387e7d5e4c210f41a89823ff097720f0b6d2948d500385e3391cfb6896e8b1fdfcaf533ca8d24f697108b415192ef
|
data/lib/aaaa_aaaa.rb
CHANGED
@@ -2,13 +2,17 @@
|
|
2
2
|
require "aaaa_aaaa/version"
|
3
3
|
|
4
4
|
module AaaaAaaa
|
5
|
+
|
6
|
+
class NotUseAaaaAaaaError < StandardError; end
|
7
|
+
|
5
8
|
class Text
|
6
|
-
def initialize(str, step=nil, prefix="")
|
9
|
+
def initialize(str, step=nil, prefix="", production: false)
|
7
10
|
@value = ""
|
8
11
|
|
9
12
|
@str = str
|
10
13
|
@step = step
|
11
14
|
@prefix = prefix
|
15
|
+
@production = production
|
12
16
|
if @step
|
13
17
|
@nextstep = step
|
14
18
|
end
|
@@ -43,7 +47,6 @@ module AaaaAaaa
|
|
43
47
|
end
|
44
48
|
|
45
49
|
def *(mul)
|
46
|
-
|
47
50
|
if @step
|
48
51
|
@iter = mul / @step
|
49
52
|
@iter.times do |x|
|
@@ -57,7 +60,11 @@ module AaaaAaaa
|
|
57
60
|
end
|
58
61
|
|
59
62
|
def to_s
|
60
|
-
@
|
63
|
+
if @production
|
64
|
+
raise NotUseAaaaAaaaError, "set procution mode. you must remove AaaaAaaa."
|
65
|
+
else
|
66
|
+
@value
|
67
|
+
end
|
61
68
|
end
|
62
69
|
end
|
63
70
|
end
|
data/lib/aaaa_aaaa/version.rb
CHANGED
data/spec/aaaa_aaaa_spec.rb
CHANGED
@@ -44,5 +44,15 @@ describe AaaaAaaa do
|
|
44
44
|
expect((AaaaAaaa::Text.new("あ", step=10, prefix="名前") * 20).to_s)
|
45
45
|
.to eq("名前" + ("あ" * 6) + "10" + "名前" + ("あ" * 6) + "20")
|
46
46
|
end
|
47
|
+
|
48
|
+
it 'production mode is raise error' do
|
49
|
+
raise_error = false
|
50
|
+
begin
|
51
|
+
(AaaaAaaa::Text.new("あ", production: true) * 20).to_s
|
52
|
+
rescue AaaaAaaa::NotUseAaaaAaaaError
|
53
|
+
raise_error = true
|
54
|
+
end
|
55
|
+
expect(raise_error).to be true
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|