lulzcatz 0.1.0 → 0.2.1

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 (2) hide show
  1. data/lib/lulzcatz.rb +7 -24
  2. metadata +2 -1
@@ -34,9 +34,9 @@ module Lolcat
34
34
  /good/ => %w/gud goed guud gude gewd/,
35
35
  /really/ => %w/rly rily rilly rilley/,
36
36
  /world/ => %w/wurrld whirld wurld wrld/,
37
- /i'?m\b/ => 'im',
38
- /(?!e)ight/ => 'ite',
39
- /(?!ues)tion/ => 'shun',
37
+ /i'?m\b/ => ['im'],
38
+ /(?!e)ight/ => ['ite'],
39
+ /(?!ues)tion/ => ['shun'],
40
40
  /you\'?re/ => %w/yore yr/,
41
41
  /\boh\b(?!.*hai)/ => %w/o ohs/,
42
42
  /can\si\s(?:ple(?:a|e)(?:s|z)e?)?\s?have\sa/ => ['i can has'],
@@ -45,17 +45,11 @@ module Lolcat
45
45
  }
46
46
 
47
47
  def self.translate(sentence)
48
- sentence_ = sentence.dup.downcase
49
- REPL.keys.each do |key|
50
- while (key =~ sentence_) == 0
51
- sentence_.sub!(key, REPL[key].sample)
52
- end
53
- end
54
- return sentence_.upcase
48
+ self.translate! sentence.dup
55
49
  end
56
50
 
57
51
  def self.translate!(sentence)
58
- sentence.downcase
52
+ sentence.downcase!
59
53
  REPL.keys.each do |key|
60
54
  while key =~ sentence
61
55
  sentence.sub!(key, REPL[key].sample)
@@ -69,21 +63,10 @@ end
69
63
  class String
70
64
 
71
65
  def to_lol
72
- ret = self.dup
73
- Lolcat.const_get(:REPL).keys.each do |key|
74
- while key =~ ret
75
- ret.sub!(key, Lolcat.const_get(:REPL)[key].sample)
76
- end
77
- end
78
- return ret.upcase
66
+ Lolcat.translate(self)
79
67
  end
80
68
 
81
69
  def to_lol!
82
- Lolcat.const_get(:REPL).keys.each do |key|
83
- while key =~ self
84
- sub!(key, Lolcat.const_get(:REPL)[key].sample)
85
- end
86
- end
87
- upcase!
70
+ Lolcat.translate!(self)
88
71
  end
89
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lulzcatz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,3 +43,4 @@ signing_key:
43
43
  specification_version: 3
44
44
  summary: Lolcat Text Converter
45
45
  test_files: []
46
+ has_rdoc: