Class: Giraffe
- Inherits:
-
Object
- Object
- Giraffe
- Defined in:
- bin/giraffe
Class Method Summary collapse
-
.random_img ⇒ Object
Pick a random image from the giraffe_gem S3 bucket.
-
.random_pic_number ⇒ Object
Number of the image we want to show from the S3 bucket.
Instance Method Summary collapse
-
#all_giraffes ⇒ Object
All of the ASCII giraffes.
- #coy_giraffe ⇒ Object
-
#random_ascii ⇒ Object
A random ASCII giraffe.
Class Method Details
.random_img ⇒ Object
Pick a random image from the giraffe_gem S3 bucket.
49 50 51 |
# File 'bin/giraffe', line 49 def self.random_img "https://s3.amazonaws.com/giraffe_gem/#{random_pic_number}.jpg" end |
.random_pic_number ⇒ Object
Number of the image we want to show from the S3 bucket.
39 40 41 42 43 44 45 46 |
# File 'bin/giraffe', line 39 def self.random_pic_number i = rand(11) if i < 10 i = "00#{i.to_s}" else i = "0#{i.to_s}" end end |
Instance Method Details
#all_giraffes ⇒ Object
All of the ASCII giraffes.
34 35 36 |
# File 'bin/giraffe', line 34 def all_giraffes methods.select { |m| m =~ /_giraffe$/ } end |
#coy_giraffe ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'bin/giraffe', line 8 def coy_giraffe coy_giraffe = " /~~~~\\ /~~~~\\\n \\ / \\ /\n | |_____| |\n /~ ~\\\n /~~~~~-_| /~~\\ /~~~\\ |_-~~~~~\\\n \\ ==== /| | O| | ^ | |\\ ==== /\n ~-__-~ | |_---+--+----_| | ~-__-~\n |/~ ~\\|\n / \\\n ( O O )\n `\\ ./`\n ~-__________-~|\n | |\\__/| |\n | |/~~\\| |\n | /~~~~~~~~~\\ |\n | | | |\n | | | |\n | | | |\n | | | |\n\n OMG GIRAFFE\nend\n" |
#random_ascii ⇒ Object
A random ASCII giraffe.
54 55 56 |
# File 'bin/giraffe', line 54 def random_ascii print send(all_giraffes[rand(all_giraffes.length)]) end |