Class: Time

Inherits:
Object show all
Defined in:
lib/core_ext/time.rb

Instance Method Summary collapse

Instance Method Details

#am?Boolean

Returns true when self indicates AM

Examples:

Time.now.am? => true or false

Returns:

  • (Boolean)

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

def am?
  hour < 12
end

#pm?Boolean

Returns true when self indicates PM

Examples:

Time.now.pm? => true or false

Returns:

  • (Boolean)

14
15
16
# File 'lib/core_ext/time.rb', line 14

def pm?
  hour >= 12
end