Module: Probatio::Helpers

Included in:
Context, Group, Section
Defined in:
lib/probatio/helpers.rb

Overview

probatio/helpers.rb

Instance Method Summary collapse

Instance Method Details

#beep(count = 1) ⇒ Object



7
8
9
10
# File 'lib/probatio/helpers.rb', line 7

def beep(count=1)

  Probatio.beep(count || 0)
end

#jruby?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/probatio/helpers.rb', line 12

def jruby?

  !! RUBY_PLATFORM.match?(/java/)
end

#time(&block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/probatio/helpers.rb', line 22

def time(&block)

  t0 = Probatio.monow

  block.call

  d = Probatio.monow - t0
  ds = Probatio.to_time_s(d)

  s, l = block.source_location

  puts(
    "\n" +
    Probatio.c.dark_grey +
    "time block at #{s}:#{l} took #{ds}" +
    Probatio.c.reset)
end

#windows?Boolean

Returns:

  • (Boolean)


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

def windows?

  Gem.win_platform?
end