Class: Doc::Tasks
Instance Attribute Summary collapse
-
#documentor ⇒ Object
readonly
Returns the value of attribute documentor.
Instance Method Summary collapse
- #count_time ⇒ Object
- #humanize_time(seconds) ⇒ Object
-
#initialize(*arguments, &block) ⇒ Tasks
constructor
A new instance of Tasks.
Constructor Details
#initialize(*arguments, &block) ⇒ Tasks
Returns a new instance of Tasks.
8 9 10 11 |
# File 'lib/doc/tasks.rb', line 8 def initialize(*arguments, &block) @documentor = Documentor.new(*arguments, &block) define end |
Instance Attribute Details
#documentor ⇒ Object (readonly)
Returns the value of attribute documentor.
7 8 9 |
# File 'lib/doc/tasks.rb', line 7 def documentor @documentor end |
Instance Method Details
#count_time ⇒ Object
24 25 26 27 28 |
# File 'lib/doc/tasks.rb', line 24 def count_time start = Time.now yield $stderr.puts "It took #{humanize_time(Time.now - start)}" end |
#humanize_time(seconds) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/doc/tasks.rb', line 13 def humanize_time(seconds) case seconds when 0...60 '%.1fs' % seconds when 60...3600 '%.1fm' % (seconds / 60) else '%.1fh' % (seconds / 3600) end end |