stringutilities 0.0.3 → 0.0.4

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/main.rb +13 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2781859f62a4ccb017fc1d4c3676ef72293853e
4
- data.tar.gz: 12a31b93a69c510eedfad4771ef43a4e18283ed0
3
+ metadata.gz: 0c2f9cbeb49d03f1e1579b1fe1027359fb65af25
4
+ data.tar.gz: f0a72549e26edefb3fa210e10cd734c6f4994eb5
5
5
  SHA512:
6
- metadata.gz: 728244ae5ca717708d462bf327854acb3dafd9131405118f56736b2219de623c2f11bc4688260bd06355000364e8ab14c7824f2d2ae1d04931cbd8fc2ffc9610
7
- data.tar.gz: 32a2ed20caa684090b78bd829bfe4e204fe2ac8d3dcf5c2e7bae4b66f91f6a5e77de92757ec0ce02b277a82bbc8b2ae77a6909d72df5047c42d4595bdeb2faae
6
+ metadata.gz: 26ec2931819547deba3dc5c0d3e5dc5616183d3e1cc3881e0cb74f5eef6bca52a6804b781ce8a1b96044677b75afb28c51f1715bd8fb169f3360187181634664
7
+ data.tar.gz: 8d012ebd8053b5398674ecd4209dcbd8d4aba8bc4f2b67ccd4c797287fa45e5647655fff0ac96fa921122cd857d36f1a54dee6b6f71c468829071c13f20781fc
@@ -1,4 +1,16 @@
1
1
  class String
2
+ #Returns a new string with word appended to self.
3
+ def append_word(word)
4
+ copy = self
5
+ copy.concat(' ') unless copy.end_with?(' ')
6
+ copy.concat(word)
7
+ return copy
8
+ end
9
+ #Appends the word to self.
10
+ def append_word!(word)
11
+ self.concat(' ') unless self.end_with?(' ')
12
+ self.concat(word)
13
+ end
2
14
  #Returns the longest word in self.
3
15
  def longest_word()
4
16
  longest = ""
@@ -41,6 +53,7 @@ class String
41
53
  self[index1] = self[index2]
42
54
  self[index2] = tempvar
43
55
  end
56
+ #Returns the number of times the word occurs.
44
57
  def word_occurrences(word)
45
58
  number_occurrences = 0
46
59
  self.words().each() do |w|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stringutilities
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SugarRush