runge 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/runge/string.rb +15 -0
  3. data/lib/runge.rb +1 -15
  4. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb6575fc21788e1795504c098caf48f9747fc68c
4
- data.tar.gz: 07d76a1bb0ec8d13311e9708868db16ddb917375
3
+ metadata.gz: e279555bd4321dc422d51baec6070debe527c671
4
+ data.tar.gz: e6e9dde788496b36da0962fa817195bc34747984
5
5
  SHA512:
6
- metadata.gz: 6c4b9cf5f3c24bb107616c7c4cc7a9156185c5ddbc0b88f121e4d5fcb62f5da58db9e4981c6f58143493772f3c92a94eb2a509ecdb9d4f2c81b76989b9925a56
7
- data.tar.gz: e545383364c29229146762e58ed06e3fad3b7a2e0f6dd4791e24ce55df0bf3082bbdf298b89ac4360fd298a32ca1134c088a24947eb6449c028cdae5f4509121
6
+ metadata.gz: 9f8799bf0b0449fb349e68339bc5f236ced936a0a0a70ea280aaa1bc4b7c545a029662d55c5c806b69fca1ec09f75720f77f2e26412f025fad682dee45b2e63e
7
+ data.tar.gz: e80a6fd01cbe248792754bc90a2c5180ea9e433945265030939cd97a5160d29a957a035f8178a2c9688ab54da5c8a101ccd570e34288819f6de572a0b11813bf
@@ -0,0 +1,15 @@
1
+ class String
2
+ # munge each string
3
+ def runge_string
4
+ # don't mutate short strings
5
+ return self if self.length == 1 || self.length == 2
6
+ # don't mutate integers
7
+ return self if self.to_i > 0
8
+ # munge each string
9
+ self.split("").each_with_index { |x, i| x.succ! if i.odd? }.join
10
+ end
11
+
12
+ def runge
13
+ self.split(/(\W)/).map(&:runge_string).join
14
+ end
15
+ end
data/lib/runge.rb CHANGED
@@ -1,15 +1 @@
1
- class Runge
2
- # munge each string
3
- def self.munge_string(string)
4
- # don't mutate short strings
5
- return string if string.length == 1 || string.length == 2
6
- # don't mutate integers
7
- return string if string.to_i > 0
8
- # munge each string
9
- string.split("").each_with_index { |x, i| x.succ! if i.odd? }.join
10
- end
11
-
12
- def self.munge(string)
13
- string.split(/(\W)/).map { |x| Runge.munge_string(x) }.join
14
- end
15
- end
1
+ require 'runge/string'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Worth
@@ -17,7 +17,8 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/runge.rb
20
- homepage:
20
+ - lib/runge/string.rb
21
+ homepage: https://github.com/jwworth/runge
21
22
  licenses:
22
23
  - MIT
23
24
  metadata: {}