juncture 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/juncture/version.rb +1 -1
- data/lib/juncture.rb +4 -2
- data/spec/juncture_spec.rb +20 -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: bc76c4cc245934c24f3e67dec255cb33949d16ba
|
4
|
+
data.tar.gz: 5f49ebd01f47ec182ae9af2f4041f904b7584562
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97a227a484135fa8309a04d720d03733d0bbe67eec4b0b93232932b3be830ed61c93ab686cf9602a3965f5d777221abed1dae9700148bc54c01dbf4b3c284c9
|
7
|
+
data.tar.gz: 8170557309b5875213a0de13fc3bc429a542a93367cb09e4855fefb478441e3f3358250aa3694ecc4d6f1ea80358eebeb3c74135ba72e9eb148fa03eae7024db
|
data/lib/juncture/version.rb
CHANGED
data/lib/juncture.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class Juncture
|
2
|
+
attr_reader :states
|
3
|
+
|
2
4
|
def initialize *states, **kwargs
|
3
5
|
@states = states
|
4
6
|
@current_state = kwargs[:default]
|
@@ -42,7 +44,7 @@ class Juncture
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def <(value)
|
45
|
-
@states[index+1..-1].include? value
|
47
|
+
@states[(index+1)..-1].include? value
|
46
48
|
end
|
47
49
|
|
48
50
|
def <=(value)
|
@@ -50,7 +52,7 @@ class Juncture
|
|
50
52
|
end
|
51
53
|
|
52
54
|
def >(value)
|
53
|
-
@states[0..index-1].include? value
|
55
|
+
@states[0..(index-1)].include? value
|
54
56
|
end
|
55
57
|
|
56
58
|
def >=(value)
|
data/spec/juncture_spec.rb
CHANGED
@@ -110,9 +110,19 @@ describe Juncture do
|
|
110
110
|
temp = Juncture.new 1, 2, 3, default: 2
|
111
111
|
expect(temp < 2).to be_false
|
112
112
|
end
|
113
|
+
|
114
|
+
it 'returns false if not matching' do
|
115
|
+
temp = Juncture.new 1, 2, 3, default: 2
|
116
|
+
expect(temp < 1).to be_false
|
117
|
+
end
|
113
118
|
end
|
114
119
|
|
115
120
|
describe '#<=' do
|
121
|
+
it 'returns true if matching' do
|
122
|
+
temp = Juncture.new 1, 2, 3, default: 2
|
123
|
+
expect(temp <= 3).to be_true
|
124
|
+
end
|
125
|
+
|
116
126
|
it 'returns true if matching' do
|
117
127
|
temp = Juncture.new 1, 2, 3, default: 2
|
118
128
|
expect(temp <= 2).to be_true
|
@@ -134,9 +144,19 @@ describe Juncture do
|
|
134
144
|
temp = Juncture.new 1, 2, 3, default: 2
|
135
145
|
expect(temp > 2).to be_false
|
136
146
|
end
|
147
|
+
|
148
|
+
it 'returns false if not matching' do
|
149
|
+
temp = Juncture.new 1, 2, 3, default: 2
|
150
|
+
expect(temp > 3).to be_false
|
151
|
+
end
|
137
152
|
end
|
138
153
|
|
139
154
|
describe '#>=' do
|
155
|
+
it 'returns true if matching' do
|
156
|
+
temp = Juncture.new 1, 2, 3, default: 2
|
157
|
+
expect(temp >= 1).to be_true
|
158
|
+
end
|
159
|
+
|
140
160
|
it 'returns true if matching' do
|
141
161
|
temp = Juncture.new 1, 2, 3, default: 2
|
142
162
|
expect(temp >= 2).to be_true
|