vocaloo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d4563afcd1d6d82c5f5cbe3b69d6bc69a4e56aaf
4
+ data.tar.gz: 89eaa74fa5abc2ba635fb8f9b144a889d9d05fb9
5
+ SHA512:
6
+ metadata.gz: 56c5a47855c0e145e5ef666962f23ee0e8985eed822953866e4fd50e112bb2d90babaeb866694aaad1c1078a3c7cd6a33f696ef018e8ff1cd55b696e3b649977
7
+ data.tar.gz: 5e02a7195edcd130db41eaea9fdff943d2aecbc3e04e525de57e61fd149d2bb0edb5a4745dda16b6959227bc3e3a5bbc6ee85106f3951d9a08bce36ba180d50c
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,14 @@
1
+ language: ruby
2
+ cache: bundler
3
+
4
+ rvm:
5
+ - 2.1.0
6
+
7
+ script: 'bundle exec rake'
8
+
9
+ notification:
10
+ email:
11
+ recipients:
12
+ - thedonnpe@gmail.com
13
+ on_failure: change
14
+ on_success: never
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vocaloo.gemspec
4
+ gemspec
@@ -0,0 +1,10 @@
1
+ guard 'rspec' do
2
+ # watch /lib/ files
3
+ watch(%r{^lib/(.+).rb$}) do |m|
4
+ "spec/#{m[1]}_spec.rb"
5
+ end
6
+ # watch /spec/ files
7
+ watch(%r{^spec/(.+).rb$}) do |m|
8
+ "spec/#{m[1]}.rb"
9
+ end
10
+ end
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Donn Pebe
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # Vocaloo
2
+
3
+ [![Build Status](https://travis-ci.org/donnpebe/vocaloo.png?branch=master)](https://travis-ci.org/donnpebe/vocaloo) [![Coverage Status](https://coveralls.io/repos/donnpebe/vocaloo/badge.png)](https://coveralls.io/r/donnpebe/vocaloo)
4
+
5
+ Make string more expresive and fun
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'vocaloo'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install vocaloo
20
+
21
+ ## Usage
22
+
23
+ ```rb
24
+ require 'vocaloo'
25
+
26
+ "Goal!".hyperbolize # => Goooaaal!
27
+ "Goal!".hyperbolize(length: 4) # => Gooooaaaal!
28
+ "Help me".dramatize # => Help me!!!
29
+ "Help me".dramatize(length: 4) # => Help me!!!!
30
+ "Google".stringosaur # => Goowrglewr
31
+ "Please".hyperbolize.dramatize # => Pleeeaaaseee!!!
32
+
33
+ Vocaloo.hyperbolize("What") # => Whaaat
34
+ Vocaloo.dramatize("What") # => What!!!
35
+ Vocaloo.stringosaur("What") # => Whawrt
36
+ ```
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create new Pull Request
@@ -0,0 +1,10 @@
1
+ require 'rspec/core/rake_task'
2
+ require "bundler/gem_tasks"
3
+
4
+ # Default directory to look in is `/specs`
5
+ # Run with `rake spec`
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = ['--color', '--format', 'nested']
8
+ end
9
+
10
+ task :default => :spec
@@ -0,0 +1,73 @@
1
+ require "vocaloo/version"
2
+
3
+ module Vocaloo
4
+ module InstanceMethods
5
+ def hyperbolize(opts={})
6
+ Vocaloo.hyperbolize(self, opts)
7
+ end
8
+
9
+ def dramatize(opts={})
10
+ Vocaloo.dramatize(self, opts)
11
+ end
12
+
13
+ def stringosaur
14
+ Vocaloo.stringosaur(self)
15
+ end
16
+
17
+ def upcase?
18
+ !!self.match(/\p{Upper}/)
19
+ end
20
+
21
+ def downcase?
22
+ !!self.match(/\p{Lower}/)
23
+ end
24
+ end
25
+
26
+ def self.vowels
27
+ ['a','i','u','e','o']
28
+ end
29
+
30
+ def self.hyperbolize(str, opts={})
31
+ length = (opts[:length] ||= 3)
32
+ new_chunk = []
33
+ str.split('').each do |a|
34
+ if vowels.include? a.downcase
35
+ new_chunk << a*length
36
+ else
37
+ new_chunk << a
38
+ end
39
+ end
40
+ new_chunk.join
41
+ end
42
+
43
+ def self.dramatize(str, opts={})
44
+ length = (opts[:length] ||= 3)
45
+ return "#{str}#{'!'*length}"
46
+ end
47
+
48
+ def self.stringosaur(str)
49
+ new_chunk = []
50
+ find_vocal = []
51
+ str.split('').each do |a|
52
+ if vowels.include? a.downcase
53
+ find_vocal << a
54
+ else
55
+ if find_vocal.empty?
56
+ new_chunk << a
57
+ else
58
+ patch = (find_vocal.last.upcase?) ? "wr".upcase : "wr"
59
+ new_chunk << "#{find_vocal.join}#{patch}#{a}"
60
+ find_vocal = []
61
+ end
62
+ end
63
+ end
64
+ unless find_vocal.empty?
65
+ patch = (find_vocal.last.upcase?) ? "wr".upcase : "wr"
66
+ new_chunk << "#{find_vocal.join}#{patch}"
67
+ end
68
+
69
+ new_chunk.join
70
+ end
71
+ end
72
+
73
+ String.send :include, Vocaloo::InstanceMethods
@@ -0,0 +1,3 @@
1
+ module Vocaloo
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ require 'pry'
5
+ require 'vocaloo'
@@ -0,0 +1,77 @@
1
+ require 'spec_helper'
2
+
3
+ describe Vocaloo do
4
+ let(:plain_string) { "GOal!" }
5
+ let(:hyperbolize_string) { "GOOOaaal!" }
6
+ let(:a4_hyperbolize_string) { "GOOOOaaaal!" }
7
+ let(:dramatize_string) { "GOal!!!!" }
8
+ let(:a4_dramatize_string) { "GOal!!!!!" }
9
+ let(:stringosaur_string) { "GOawrl!" }
10
+ let(:duplicate_vowels) { "GOOOGLE" }
11
+ let(:stringosaur_duplicate_vowels) { "GOOOWRGLEWR" }
12
+
13
+ describe '::hyperbolize' do
14
+ it 'should return a string with double vowels then before' do
15
+ subject.hyperbolize(plain_string).should == hyperbolize_string
16
+ end
17
+ end
18
+
19
+ describe '::hyperbolize(plain_string, { :length => 4 }' do
20
+ it 'should return a string with quadruple vowels then before' do
21
+ subject.hyperbolize(plain_string, { :length => 4 }).should == a4_hyperbolize_string
22
+ end
23
+ end
24
+
25
+ describe '::dramatize' do
26
+ it "should return a string that adds with triple '!'" do
27
+ subject.dramatize(plain_string).should == dramatize_string
28
+ end
29
+ end
30
+
31
+ describe '::dramatize(plain_string, { :length => 4 }' do
32
+ it "should return a string that adds with quadruple '!'" do
33
+ subject.dramatize(plain_string, { :length => 4 }).should == a4_dramatize_string
34
+ end
35
+ end
36
+
37
+ describe '::stringosaur' do
38
+ it "should return a string that adds dinosaurs lingo" do
39
+ subject.stringosaur(plain_string).should == stringosaur_string
40
+ end
41
+ end
42
+
43
+ describe '::stringosaur' do
44
+ it "should only apply the transformation in the last sequence vocals" do
45
+ duplicate_vowels.stringosaur.should == stringosaur_duplicate_vowels
46
+ end
47
+ end
48
+
49
+ describe '.In String instance' do
50
+ describe '#hyperbolize' do
51
+ it 'should respond to hyperbolize' do
52
+ plain_string.should be_respond_to(:hyperbolize)
53
+ end
54
+ it 'should return hyperbolize string' do
55
+ plain_string.hyperbolize.should == hyperbolize_string
56
+ end
57
+ end
58
+
59
+ describe '#dramatize' do
60
+ it 'should respond to dramatize' do
61
+ plain_string.should be_respond_to(:dramatize)
62
+ end
63
+ it 'should return dramatize string' do
64
+ plain_string.dramatize.should == dramatize_string
65
+ end
66
+ end
67
+
68
+ describe '#stringosaur' do
69
+ it 'should respond to stringosaur' do
70
+ plain_string.should be_respond_to(:stringosaur)
71
+ end
72
+ it 'should return stringosaur string' do
73
+ plain_string.stringosaur.should == stringosaur_string
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vocaloo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vocaloo"
8
+ spec.version = Vocaloo::VERSION
9
+ spec.authors = ["Donn Pebe"]
10
+ spec.email = ["thedonnpe@gmail.com"]
11
+ spec.description = "Make string more expresive and fun"
12
+ spec.summary = %q{Extends ruby "String" class with some silly methods to
13
+ make string more expresive and fun}
14
+ spec.homepage = "https://github.com/donnpebe/vocaloo"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "rspec", "2.14.1"
25
+ spec.add_development_dependency "rspec-nc", "~> 0.0.6"
26
+ spec.add_development_dependency "guard", "2.6.0"
27
+ spec.add_development_dependency "guard-rspec", "4.2.8"
28
+ spec.add_development_dependency "pry"
29
+ spec.add_development_dependency "pry-remote"
30
+ spec.add_development_dependency "pry-nav"
31
+ spec.add_development_dependency "coveralls"
32
+ end
metadata ADDED
@@ -0,0 +1,200 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vocaloo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Donn Pebe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.14.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.14.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-nc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.6
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 0.0.6
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 2.6.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 2.6.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 4.2.8
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 4.2.8
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-remote
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-nav
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: coveralls
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Make string more expresive and fun
154
+ email:
155
+ - thedonnpe@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - .coveralls.yml
161
+ - .gitignore
162
+ - .travis.yml
163
+ - Gemfile
164
+ - Guardfile
165
+ - LICENSE.txt
166
+ - README.md
167
+ - Rakefile
168
+ - lib/vocaloo.rb
169
+ - lib/vocaloo/version.rb
170
+ - spec/spec_helper.rb
171
+ - spec/vocaloo_spec.rb
172
+ - vocaloo.gemspec
173
+ homepage: https://github.com/donnpebe/vocaloo
174
+ licenses:
175
+ - MIT
176
+ metadata: {}
177
+ post_install_message:
178
+ rdoc_options: []
179
+ require_paths:
180
+ - lib
181
+ required_ruby_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ required_rubygems_version: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - '>='
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ requirements: []
192
+ rubyforge_project:
193
+ rubygems_version: 2.2.2
194
+ signing_key:
195
+ specification_version: 4
196
+ summary: Extends ruby "String" class with some silly methods to make string more expresive
197
+ and fun
198
+ test_files:
199
+ - spec/spec_helper.rb
200
+ - spec/vocaloo_spec.rb