xsay 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xsay.rb +7 -6
- data/lib/xsay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da403ee03507c6166b8e37febef799b2c0f9aea3fc410ea62141fe2616b01dd6
|
4
|
+
data.tar.gz: a791a342b414ce587290ef8ce888a448d61b88dced992bcff5917ddc832aa8a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84334bdc4466855689dd6db479a8df0c969437e716d6d9943f2b0052b7ad006c8ff8671fe1435da1a15f94cd2f663043018714df770ada87febc47ee8e78322d
|
7
|
+
data.tar.gz: ecf1d4fe18be44db9ec5b7f320fa98277b3d3de454820a35a907797e51cc0430c31ce3fc8725f4865dec3dbf05839bd734badf3e68d95f3620aa9c73d72ab6c3
|
data/lib/xsay.rb
CHANGED
@@ -9,26 +9,27 @@ module Xsay
|
|
9
9
|
animal = File.basename(filename).split(".")[0]
|
10
10
|
|
11
11
|
desc "#{animal} <message>", "xsay #{animal} hello"
|
12
|
-
define_method animal do |
|
13
|
-
render(
|
12
|
+
define_method animal do |*args|
|
13
|
+
render(args, IO.read(filename))
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "all <message>", "xsay all hello"
|
18
|
-
def all(
|
18
|
+
def all(*args)
|
19
19
|
ANIMALS.each do |filename|
|
20
|
-
render(
|
20
|
+
render(args, IO.read(filename))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
desc "random <message>", "xsay random hello"
|
25
|
-
def random(
|
26
|
-
render(
|
25
|
+
def random(*args)
|
26
|
+
render(args, IO.read(ANIMALS.shuffle.sample))
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def render(message, template)
|
32
|
+
message = message.join(' ') if message.respond_to?(:join)
|
32
33
|
line_break = "-" * message.length
|
33
34
|
say <<-MESSAGE
|
34
35
|
#{line_break}
|
data/lib/xsay/version.rb
CHANGED