pig_latin_rb 0.0.1 → 0.0.2

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: 95e0736990fb27aa33a528d0e2c851619d8c171b
4
- data.tar.gz: 45a7a91985512ef8abd00ab073300464f5824466
3
+ metadata.gz: a96b483b08e593ae284d9ef0ddff262908a3855f
4
+ data.tar.gz: d81ca9409cfdb42be7a4dcba4464060742114a36
5
5
  SHA512:
6
- metadata.gz: 462539f3295b08c1a697c683ffc0dcf9c48e3a97c24cb9a9a23ed0c29dc5095ce5f7d39d8671a2b796621b30329daa907bb188d8eb4a5f4452d3d8386fa8afcb
7
- data.tar.gz: 3328ac0ed034ea45c850276d93bce3ae604600da09f92cfc3588f8c4c8ee233ee3c84c4795773069cd3d0f5d9e35044a55194db722e99d9bb2513a1ff850e218
6
+ metadata.gz: ee454d4ee39012c0cf7288898e32e54c68d4f0c6cb1d430a409b27e27a2ffba7c16b4770e99b925208700d4a75028b7de6206de1e71fe47f7989362e2a25196c
7
+ data.tar.gz: 2c4903d9a04ce88f7d04aaaf171d707d93806635d339139c5561586ba6f9c70a990f2c9bcfbd6664f32e2d5520f9250357a5ade5a06d6aa651ac2597e9b0956e
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
1
  require "bundler/gem_tasks"
2
+ Bundler::GemHelper.install_tasks
2
3
 
3
- task :pig_latin, [:arg1] do |t, args|
4
- PigLatinRb.pig_latin(args[:arg1])
5
- end
@@ -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
@@ -0,0 +1,5 @@
1
+ module PigLatinRb
2
+ class Constants
3
+ VOWELS = ['a', 'e', 'i', 'o', 'u']
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module PigLatinRb
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,11 @@
1
+ module PigLatinRb
2
+ class VowelHandler
3
+ def initialize(word)
4
+ @word = word
5
+ end
6
+
7
+ def print_pig_latin
8
+ @word + 'way'
9
+ end
10
+ end
11
+ end
data/lib/pig_latin_rb.rb CHANGED
@@ -1,11 +1,9 @@
1
- require "pig_latin_rb/version"
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
- lib = File.expand_path('../lib', __FILE__)
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.1
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: