rapeech_counter 0.0.1 → 0.2.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e12d3c927a3e68b4636e1e58b8cbec463a2ec8948e093c45f28838f71ae2b6d
|
4
|
+
data.tar.gz: 96017fdc558d53165fd87bd7ef4f76e9ed4d89779c9e5aafbf02da0bc0de655f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2776edeb58f6cc00c84054d4885e0eeffd49995c6b514fdc17155aef4010ca46ee7773c06941182316632f790068630deb4afeaae043c393eb3d4643e2ae407d
|
7
|
+
data.tar.gz: 345812579abf433ddd849de7c41e12842b80bb06e685223b54383d42b59c10f0953bb8815aa9770e0bea097224fbed2430285f737e36ac884f225a91aff3c520
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RapeechCounter
|
2
|
+
class Counter
|
3
|
+
attr_reader :value
|
4
|
+
|
5
|
+
def initialize(strategy:, initial: 0)
|
6
|
+
@strategy = strategy
|
7
|
+
@value = initial
|
8
|
+
end
|
9
|
+
|
10
|
+
def increment
|
11
|
+
@value = @strategy.increment(@value)
|
12
|
+
end
|
13
|
+
|
14
|
+
def reset(initial = 0)
|
15
|
+
@value = initial
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rapeech_counter.rb
CHANGED
@@ -1,11 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
@@a += 1
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.a
|
9
|
-
@@a
|
10
|
-
end
|
11
|
-
end
|
1
|
+
require "rapeech_counter/counter"
|
2
|
+
require "rapeech_counter/strategies/linear"
|
3
|
+
require "rapeech_counter/strategies/multiplier"
|
4
|
+
require "rapeech_counter/strategies/exponential"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapeech_counter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youngwoo ko
|
@@ -16,6 +16,10 @@ extensions: []
|
|
16
16
|
extra_rdoc_files: []
|
17
17
|
files:
|
18
18
|
- lib/rapeech_counter.rb
|
19
|
+
- lib/rapeech_counter/counter.rb
|
20
|
+
- lib/rapeech_counter/strategies/exponential.rb
|
21
|
+
- lib/rapeech_counter/strategies/linear.rb
|
22
|
+
- lib/rapeech_counter/strategies/multiplier.rb
|
19
23
|
homepage: http://rubygems.org/gems/rapeech_counter
|
20
24
|
licenses:
|
21
25
|
- MIT
|