prudding 0.0.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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/prudding.rb +25 -0
  3. data/lib/string.rb +6 -0
  4. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7524bbf11a5ebf4b41c96b04c27ce1f9bd4d2b9e34a192787b7feb0b906f895d
4
+ data.tar.gz: ca53abfa610de9696527b1256005a9a36a35cbbe404925b451f2a2beba1c0945
5
+ SHA512:
6
+ metadata.gz: eb298331c2b3df08cac383b2dc510300b388fca66eeba5dd4a7e3256bc91b80474d9a316be48deba5a098f0e80c62899dea33ae12ff61b4396b27228653ce843
7
+ data.tar.gz: 1835d2588be5bcbf093347e380d6094cfde76b248984a46179f19f831fc28c8e323b92f04629212c4166a19d8295c6315fa31e6397f9dd41e2c2fa063bb19c07
data/lib/prudding.rb ADDED
@@ -0,0 +1,25 @@
1
+ class Prudding
2
+ def initialize(string)
3
+ @words = string.split(' ')
4
+ end
5
+
6
+ def to_prudding
7
+ @words.map do |w|
8
+ if (idx = w.chars.index { |c| c =~ /[aeiou]/ }) && w.length > 3
9
+ if idx > 0
10
+ w.chars.insert(idx, "r").join('')
11
+ else
12
+ w
13
+ end
14
+ else
15
+ w
16
+ end
17
+ end.join(" ")
18
+ end
19
+ end
20
+
21
+ class String
22
+ def prudding
23
+ Prudding.new(self).to_prudding
24
+ end
25
+ end
data/lib/string.rb ADDED
@@ -0,0 +1,6 @@
1
+ class String
2
+ def prudding
3
+ prud = Prudding.new(self)
4
+ prud.to_prudding
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prudding
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sam Starling
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Cronverts your srentences to prudding-format
14
+ email: mail@samstarling.co.uk
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/prudding.rb
20
+ - lib/string.rb
21
+ homepage: http://rubygems.org/gems/prudding
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.7.6
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: prudding
45
+ test_files: []