-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheach_with_index.rb
executable file
·35 lines (23 loc) · 1.13 KB
/
each_with_index.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env ruby
require './lib/initialize'
puts "all numbers with index: "
@numbers.each_with_index{|number, i| puts " #{i}: #{number}"}
puts "the even status for all numbers, with index: "
@numbers.each_with_index{|number, i| puts " #{i}: #{number.even?}"}
divider
puts "leg counts for all pets, with index: "
@inventory.each_with_index{|pet, i| puts " #{i}: #{pet.legs}"}
puts "leg totals for each pet type, with index: "
@inventory.each_with_index{|pet, i| puts " #{i}: #{pet.legs * pet.quantity}"}
divider
@pokey_things.seek(0)
puts "letter counts for all pokey things, with index: "
@pokey_things.each_with_index{|thing, i| puts " #{i}: #{thing.chomp.size}"}
@pokey_things.seek(0)
puts "all pokey things, capitalized, with index: "
@pokey_things.each_with_index{|thing, i| puts " #{i}: #{thing.chomp.capitalize}"}
divider
puts "request methods for all heroku requests, with index: "
@requests.each_with_index{|request, i| puts " #{i}: #{request.method}"}
puts "total response times for all heroku requests, with index: "
@requests.each_with_index{|request, i| puts " #{i}: #{request.connect + request.service}"}