lulzcatz 0.1.0

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 +89 -0
  2. metadata +45 -0
data/lib/lulzcatz.rb ADDED
@@ -0,0 +1,89 @@
1
+ module Lolcat
2
+ REPL = {
3
+ /what/ => %w/wut whut/, /you\b/ => %w/yu yous yoo u/,
4
+ /cture/ => ['kshur'], /unless/ => ['unles'],
5
+ /the\b/=> ['teh'], /more/ => ['moar'],
6
+ /my/ => %w/muh mah/, /are/ => %w/r is ar/,
7
+ /eese/ => ['eez'], /ph/ => ['f'],
8
+ /as\b/ => ['az'], /seriously/ => ['srsly'],
9
+ /er\b/ => ['r'], /sion/ => ['shun'],
10
+ /just/ => ['jus'], /ose\b/ => ['oze'],
11
+ /eady/ => ['eddy'], /ome?\b/ => ['um'],
12
+ /of\b/ => %w/of ov of/, /uestion/ => ['wesjun'],
13
+ /want/ => %w/wants/, /ead\b/ => ['edd'],
14
+ /ucke/ => %w/ukki ukke/, /sion/ => ['shun'],
15
+ /eak/ => %w/ekk/, /age/ => ['uj'],
16
+ /like/ => %w/likes liek/, /love/ => %w/loves lub lubs luv/,
17
+ /\bis\b/ => %w/ar teh ar/, /nd\b/ => ['n'],
18
+ /who/ => %w/hoo/, /\'/ => [''],
19
+ /ese\b/ => %w/eez/, /outh/ => %w/owf/,
20
+ /scio/ => ['shu'], /esque/ => %w/esk/,
21
+ /ture/ => ['chur'], /\btoo?\b/=> %w/to t 2 to t/,
22
+ /tious/ => ['shus'], /sure\b/ => ['shur'],
23
+ /tty\b/ => ['tteh'], /were/ => ['was'],
24
+ /ok\b/ => %w/'k kay/ , /\ba\b/ => [''],
25
+ /ym/ => ['im'], /thy\b/ => ['fee'],
26
+ /\wly\w/ => ['li'], /que\w/ => ['kwe'],
27
+ /oth/ => ['udd'], /ease/ => ['eez'],
28
+ /ing\b/ => %w/in ins ng ing/,
29
+ /have/ => %w/has hav haz a/,
30
+ /your/ => %w/yur ur yore yoar/,
31
+ /ove\b/ => %w/oov ove uuv uv oove/,
32
+ /for/ => %w/for 4 fr fur for foar/,
33
+ /thank/ => %w/fank tank thx thnx/,
34
+ /good/ => %w/gud goed guud gude gewd/,
35
+ /really/ => %w/rly rily rilly rilley/,
36
+ /world/ => %w/wurrld whirld wurld wrld/,
37
+ /i'?m\b/ => 'im',
38
+ /(?!e)ight/ => 'ite',
39
+ /(?!ues)tion/ => 'shun',
40
+ /you\'?re/ => %w/yore yr/,
41
+ /\boh\b(?!.*hai)/ => %w/o ohs/,
42
+ /can\si\s(?:ple(?:a|e)(?:s|z)e?)?\s?have\sa/ => ['i can has'],
43
+ /(?:hello|\bhi\b|\bhey\b|howdy|\byo\b),?/ => ['oh hai,'],
44
+ /(?:god|allah|buddah?|diety)/ => ['ceiling cat'],
45
+ }
46
+
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
55
+ end
56
+
57
+ def self.translate!(sentence)
58
+ sentence.downcase
59
+ REPL.keys.each do |key|
60
+ while key =~ sentence
61
+ sentence.sub!(key, REPL[key].sample)
62
+ end
63
+ end
64
+ return sentence.upcase!
65
+ end
66
+
67
+ end
68
+
69
+ class String
70
+
71
+ 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
79
+ end
80
+
81
+ 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!
88
+ end
89
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lulzcatz
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matt Carey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-16 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A port of Acme::LOLCAT to ruby
15
+ email: matthew.b.carey@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/lulzcatz.rb
21
+ homepage: http://lsden.net/
22
+ licenses: []
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 1.8.11
42
+ signing_key:
43
+ specification_version: 3
44
+ summary: Lolcat Text Converter
45
+ test_files: []