microscope 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/irregular_verbs.yml +2 -0
- data/lib/microscope/instance_method.rb +6 -2
- data/lib/microscope/version.rb +1 -1
- data/spec/microscope/instance_method_spec.rb +15 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0b1a959c55d680d6eb38ad762324e8b158546d5
|
4
|
+
data.tar.gz: 101b9f5e4e80977535d936fae45a791862f0d49c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c570297e11b58f9941fc8d47cbb62a4a8341fddb36e2cb24c5c368ac47922dc240ded07d5b98b0d92435662a762e0381ec2236bb9fcb3b23da66b5df6f6ac43
|
7
|
+
data.tar.gz: 463ac93cdcca8b54da650b84ae92d5e3b5583df028a534ec41310068cc2c76407f3850d3d427bfa0c727e2e3228ee6eda60c22357088178647ba8f8c838c3ceb
|
data/data/irregular_verbs.yml
CHANGED
@@ -12,14 +12,18 @@ module Microscope
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# Convert a past participle to its infinitive form
|
15
|
-
def self.past_participle_to_infinitive(
|
16
|
-
|
15
|
+
def self.past_participle_to_infinitive(key)
|
16
|
+
*key, participle = key.split('_')
|
17
|
+
|
18
|
+
infinitive = if Microscope.irregular_verbs.include?(participle)
|
17
19
|
Microscope.irregular_verbs[participle]
|
18
20
|
elsif participle =~ /ed$/
|
19
21
|
participle.sub(/d$/, '')
|
20
22
|
else
|
21
23
|
participle
|
22
24
|
end
|
25
|
+
|
26
|
+
(key << infinitive).join('_')
|
23
27
|
end
|
24
28
|
|
25
29
|
# Convert a value to its boolean representation
|
data/lib/microscope/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Microscope::InstanceMethod do
|
4
|
+
describe :ClassMethods do
|
5
|
+
describe :past_participle_to_infinitive do
|
6
|
+
let(:past_participles) { ['liked', 'loved', 'gateway_canceled', 'started', 'fed'] }
|
7
|
+
let(:infinitives) { ['like', 'love', 'gateway_cancel', 'start', 'feed'] }
|
8
|
+
let(:mapped_past_participles) { past_participles.map { |v| Microscope::InstanceMethod.past_participle_to_infinitive(v) } }
|
9
|
+
|
10
|
+
specify do
|
11
|
+
expect(mapped_past_participles).to eql infinitives
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Prévost
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-01-
|
12
|
+
date: 2014-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- spec/microscope/instance_method/boolean_instance_method_spec.rb
|
171
171
|
- spec/microscope/instance_method/date_instance_method_spec.rb
|
172
172
|
- spec/microscope/instance_method/datetime_instance_method_spec.rb
|
173
|
+
- spec/microscope/instance_method_spec.rb
|
173
174
|
- spec/microscope/scope/boolean_scope_spec.rb
|
174
175
|
- spec/microscope/scope/date_scope_spec.rb
|
175
176
|
- spec/microscope/scope/datetime_scope_spec.rb
|
@@ -210,6 +211,7 @@ test_files:
|
|
210
211
|
- spec/microscope/instance_method/boolean_instance_method_spec.rb
|
211
212
|
- spec/microscope/instance_method/date_instance_method_spec.rb
|
212
213
|
- spec/microscope/instance_method/datetime_instance_method_spec.rb
|
214
|
+
- spec/microscope/instance_method_spec.rb
|
213
215
|
- spec/microscope/scope/boolean_scope_spec.rb
|
214
216
|
- spec/microscope/scope/date_scope_spec.rb
|
215
217
|
- spec/microscope/scope/datetime_scope_spec.rb
|