Methods
Class Index
- WebRI
- WebRI::Blackfish
- WebRI::Component
- WebRI::Generator
- WebRI::GeneratorOne
- WebRI::GitHub
- WebRI::Heirarchy
- WebRI::Highlight
- WebRI::Icons
- WebRI::JSONFile
- WebRI::Longfish
- WebRI::Metadata
- WebRI::Newfish
- WebRI::Oldfish
- WebRI::Onefish
- WebRI::Prettify
- WebRI::Redfish
- WebRI::RiService
- WebRI::Search
- WebRI::Search::FilesTree
- WebRI::Server
- WebRI::Subversion
- WebRI::Template
- WebRI::TimeDelta
- WebRI::Twofish
- RDoc
- RDoc::AnyMethod
- RDoc::ClassModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::TopLevel
- Syckle
- Syckle::Plugins
- Syckle::Plugins::WebRI
- Object
- OpEsc
TimeDelta
Constants
Public Instance Methods
time_delta_string(seconds)
click to toggle source
Return a string describing the amount of time in the given number of seconds in terms a human can understand easily.
# File lib/webri/generators/abstract/timedelta.rb, line 14 def time_delta_string(seconds) return 'less than a minute' if seconds < MINUTES return (seconds / MINUTES).to_s + ' minute' + (seconds/60 == 1 ? '' : 's') if seconds < (50 * MINUTES) return 'about one hour' if seconds < (90 * MINUTES) return (seconds / HOURS).to_s + ' hours' if seconds < (18 * HOURS) return 'one day' if seconds < DAYS return 'about one day' if seconds < (2 * DAYS) return (seconds / DAYS).to_s + ' days' if seconds < WEEKS return 'about one week' if seconds < (2 * WEEKS) return (seconds / WEEKS).to_s + ' weeks' if seconds < (3 * MONTHS) return (seconds / MONTHS).to_s + ' months' if seconds < YEARS return (seconds / YEARS).to_s + ' years' end
Disabled; run with --debug to generate this.