womanizer 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/womanizer +14 -8
- data/lib/womanizer.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1697a5ccc1abd818fa7fb893aec80775bb797ec4
|
4
|
+
data.tar.gz: dc0e2a52dbae2d93c2ddecd9e9408d4377d804da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc2de7aba5e0e4909662171658f962de5dd5623dffeedf01f01c14b6a9b44f233e277c61d9e4895b09a549f2468c0a257fe56ebd94dae97f5fefdad6392472ce
|
7
|
+
data.tar.gz: f04aa5783af5f7091caf3bf60695195452296cb42cb18ae52d292cbf14c7bcb1bf6653a074c684fba8ddcdc4e0cbdab0735fc7509a4ae5376c589e4ea50e7481
|
data/bin/womanizer
CHANGED
@@ -2,16 +2,22 @@
|
|
2
2
|
|
3
3
|
$:.unshift File.expand_path('../../lib', __FILE__)
|
4
4
|
require 'womanizer'
|
5
|
-
|
5
|
+
word = ENV['WORD']
|
6
|
+
w = word.nil? ? Womanizer.new : Womanizer.new(word)
|
6
7
|
|
7
|
-
|
8
|
-
when 'encode'
|
9
|
-
puts w.encode $<.read
|
10
|
-
when 'decode'
|
11
|
-
puts w.decode $<.read
|
12
|
-
when 'run'
|
8
|
+
if ARGV.length == 1 # no action given, ie shebang
|
13
9
|
w.define!
|
14
10
|
eval $<.read
|
15
11
|
else
|
16
|
-
|
12
|
+
case action = ARGV.shift
|
13
|
+
when 'encode'
|
14
|
+
puts w.encode $<.read
|
15
|
+
when 'decode'
|
16
|
+
puts w.decode $<.read
|
17
|
+
when 'run', nil, ''
|
18
|
+
w.define!
|
19
|
+
eval $<.read
|
20
|
+
else
|
21
|
+
raise ArgumentError, "bad action: #{action.inspect}, must be run, encode or decode"
|
22
|
+
end
|
17
23
|
end
|
data/lib/womanizer.rb
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
class Womanizer
|
4
|
-
VERSION = '0.1.
|
4
|
+
VERSION = '0.1.1'
|
5
5
|
|
6
6
|
def self.ok!(*a)
|
7
7
|
$womanizer = Womanizer.new(*a)
|
8
8
|
$womanizer.define!
|
9
9
|
end
|
10
10
|
|
11
|
-
def initialize(words
|
11
|
+
def initialize(*words)
|
12
|
+
words = ['morewoman', 'morewomen'] if words.empty?
|
12
13
|
words = words.map(&:downcase).uniq
|
13
14
|
|
14
15
|
raise ArgumentError, 'needs words with length of at least 8' if words.any? { |w| w.length < 8 }
|