Class: Time

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

Overview

Copyright 2014 Maxine Red <[email protected]>

This file is part of rubyhexagon.

rubyhexagon is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

rubyhexagon is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with rubyhexagon.  If not, see <http://www.gnu.org/licenses/>.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.measureObject

This methods takes a block and returns how long it took to execute that block.



25
26
27
28
29
# File 'lib/standard/time.rb', line 25

def self.measure
  s = Time.now
  yield
  return Time.now-s
end

Instance Method Details

#to_sObject

A general to_s function for Time objects.



21
22
23
# File 'lib/standard/time.rb', line 21

def to_s
  self.strftime("%b %e,%Y %I:%M %p")
end