Class: Doc::Tasks

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/doc/tasks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#documentorObject (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_timeObject



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