Module: Helpers

Defined in:
lib/helpers.rb

Instance Method Summary collapse

Instance Method Details

#clear_screenObject



30
31
32
# File 'lib/helpers.rb', line 30

def clear_screen
  Gem.win_platform? ? (system "cls") : (system "clear")
end

#confirm(input = gets.chomp) ⇒ Object



15
16
17
18
19
20
# File 'lib/helpers.rb', line 15

def confirm(input=gets.chomp)
  if input.to_b
    return true
  end
  false
end

#network?Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/helpers.rb', line 10

def network?
  connection = Net::Ping::TCP.new('google.com', 80, 5)
  connection.ping?
end

#timeObject

Formatted as: 03/07/2017 14:26



6
7
8
# File 'lib/helpers.rb', line 6

def time
  Time.now.strftime("%m/%d/%Y %H:%M")
end

#to_minutes(seconds) ⇒ Object



22
23
24
# File 'lib/helpers.rb', line 22

def to_minutes(seconds)
  seconds.to_f / 60
end

#to_seconds(minutes) ⇒ Object



26
27
28
# File 'lib/helpers.rb', line 26

def to_seconds(minutes)
  minutes.to_f * 60
end