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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7602cb25b5b12f243c0380bb3f66a8d126bc0d53
4
- data.tar.gz: 592d56ccc94f58eccfbae50646beb09f7b06547e
3
+ metadata.gz: c0b1a959c55d680d6eb38ad762324e8b158546d5
4
+ data.tar.gz: 101b9f5e4e80977535d936fae45a791862f0d49c
5
5
  SHA512:
6
- metadata.gz: da0941107f2b282149fbb7321d7cf402aa354b4407657b3cf57d3f2dbebb88f6f255bbb6a21f9d5692fbc3fdc3659a5ad75e7b7c611871f8306cc188d7a30933
7
- data.tar.gz: 0b78e8dfb69a15ebf94759b503d1c8ff1f00b7d7c1de145efd227ebf3694ed6778930ef4158e19bdac81e0e1672ed987fe4a1e11fe87ffc5ec54f6a2987ccdff
6
+ metadata.gz: 9c570297e11b58f9941fc8d47cbb62a4a8341fddb36e2cb24c5c368ac47922dc240ded07d5b98b0d92435662a762e0381ec2236bb9fcb3b23da66b5df6f6ac43
7
+ data.tar.gz: 463ac93cdcca8b54da650b84ae92d5e3b5583df028a534ec41310068cc2c76407f3850d3d427bfa0c727e2e3228ee6eda60c22357088178647ba8f8c838c3ceb
@@ -18,6 +18,8 @@ burnt: burn
18
18
  burst: burst
19
19
  bought: buy
20
20
  caught: catch
21
+ canceled: cancel
22
+ cancelled: cancel
21
23
  chosen: choose
22
24
  clung: cling
23
25
  come: come
@@ -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(participle)
16
- if Microscope.irregular_verbs.include?(participle)
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
@@ -1,3 +1,3 @@
1
1
  module Microscope
2
- VERSION = '0.5.3'
2
+ VERSION = '0.5.4'
3
3
  end
@@ -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.3
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-08 00:00:00.000000000 Z
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