pig_latin_rb 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.
- checksums.yaml +4 -4
- data/Rakefile +1 -3
- data/lib/pig_latin_rb/consonant_handler.rb +22 -0
- data/lib/pig_latin_rb/constants.rb +5 -0
- data/lib/pig_latin_rb/version.rb +1 -1
- data/lib/pig_latin_rb/vowel_handler.rb +11 -0
- data/lib/pig_latin_rb.rb +1 -3
- data/pig_latin_rb-0.0.1.gem +0 -0
- data/pig_latin_rb.gemspec +2 -4
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a96b483b08e593ae284d9ef0ddff262908a3855f
|
4
|
+
data.tar.gz: d81ca9409cfdb42be7a4dcba4464060742114a36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee454d4ee39012c0cf7288898e32e54c68d4f0c6cb1d430a409b27e27a2ffba7c16b4770e99b925208700d4a75028b7de6206de1e71fe47f7989362e2a25196c
|
7
|
+
data.tar.gz: 2c4903d9a04ce88f7d04aaaf171d707d93806635d339139c5561586ba6f9c70a990f2c9bcfbd6664f32e2d5520f9250357a5ade5a06d6aa651ac2597e9b0956e
|
data/Rakefile
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
module PigLatinRb
|
2
|
+
|
3
|
+
class ConsonantHandler
|
4
|
+
def initialize(word)
|
5
|
+
@char_array = word.chars
|
6
|
+
end
|
7
|
+
|
8
|
+
def print_pig_latin
|
9
|
+
intermediate_word = []
|
10
|
+
@char_array.each_with_index do |value, index|
|
11
|
+
if Constants::VOWELS.include?(value)
|
12
|
+
intermediate_word = @char_array[index..-1] + intermediate_word
|
13
|
+
break
|
14
|
+
else
|
15
|
+
intermediate_word << value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
intermediate_word << 'ay'
|
19
|
+
intermediate_word.join('')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/pig_latin_rb/version.rb
CHANGED
data/lib/pig_latin_rb.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
require
|
1
|
+
require 'pig_latin_rb/version'
|
2
2
|
require 'pig_latin_rb/constants'
|
3
3
|
require 'pig_latin_rb/vowel_handler'
|
4
4
|
require 'pig_latin_rb/consonant_handler'
|
5
5
|
|
6
6
|
module PigLatinRb
|
7
|
-
include Constants
|
8
|
-
|
9
7
|
def self.pig_latin(word)
|
10
8
|
handler = if Constants::VOWELS.include?(word[0])
|
11
9
|
VowelHandler.new(word)
|
Binary file
|
data/pig_latin_rb.gemspec
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'pig_latin_rb/version'
|
2
|
+
require File.expand_path('../lib/pig_latin_rb/version', __FILE__)
|
5
3
|
|
6
4
|
Gem::Specification.new do |spec|
|
7
5
|
spec.name = "pig_latin_rb"
|
8
|
-
spec.version = PigLatinRb::VERSION
|
9
6
|
spec.authors = ["xhagrg"]
|
10
7
|
spec.email = ["grg.iksha@hotmail.com"]
|
11
8
|
spec.summary = %q{Pig Latin generator}
|
@@ -18,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
18
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
16
|
spec.require_paths = ["lib"]
|
20
17
|
|
18
|
+
spec.version = PigLatinRb::VERSION
|
21
19
|
spec.add_development_dependency "bundler", "~> 1.7"
|
22
20
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pig_latin_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xhagrg
|
@@ -51,7 +51,11 @@ files:
|
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
53
|
- lib/pig_latin_rb.rb
|
54
|
+
- lib/pig_latin_rb/consonant_handler.rb
|
55
|
+
- lib/pig_latin_rb/constants.rb
|
54
56
|
- lib/pig_latin_rb/version.rb
|
57
|
+
- lib/pig_latin_rb/vowel_handler.rb
|
58
|
+
- pig_latin_rb-0.0.1.gem
|
55
59
|
- pig_latin_rb.gemspec
|
56
60
|
homepage: ''
|
57
61
|
licenses:
|