Class: Giraffe

Inherits:
Object
  • Object
show all
Defined in:
bin/giraffe

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.random_imgObject

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_numberObject

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_giraffesObject

All of the ASCII giraffes.



34
35
36
# File 'bin/giraffe', line 34

def all_giraffes
  methods.select { |m| m =~ /_giraffe$/ }
end

#coy_giraffeObject



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 = <<-'OMG GIRAFFE' 
            /~~~~\   /~~~~\
            \    /   \    /
             |  |_____|  |
           /~             ~\
  /~~~~~-_|  /~~\    /~~~\  |_-~~~~~\
  \ ==== /| |   O|  |   ^ | |\ ==== /
   ~-__-~ | |_---+--+----_| | ~-__-~
          |/~             ~\|
          /                 \
         (      O      O     )
          `\              ./`
            ~-__________-~|
            |   |\__/|    |
            |   |/~~\|    |
            | /~~~~~~~~~\ |
            | |         | |
            | |         | |
            | |         | |
            | |         | |

  OMG GIRAFFE
end

#random_asciiObject

A random ASCII giraffe.



54
55
56
# File 'bin/giraffe', line 54

def random_ascii
  print send(all_giraffes[rand(all_giraffes.length)])
end