Class: Yardstick::Rake::Measurement

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/yardstick/rake/measurement.rb

Overview

A rake task for measuring docs in a set of files

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :yardstick_measure) {|task| ... } ⇒ Yardstick::Rake::Measurement

Initializes a Measurement task

Examples:

task = Yardstick::Rake::Measurement

Parameters:

  • name (Symbol) (defaults to: :yardstick_measure)

    optional task name

Yields:

  • (task)

    yield to self

Yield Parameters:



50
51
52
53
54
55
56
57
58
59
# File 'lib/yardstick/rake/measurement.rb', line 50

def initialize(name = :yardstick_measure)
  @name = name
  @path = 'lib/**/*.rb'

  self.output = 'measurements/report.txt'

  yield self if block_given?

  define
end

Instance Attribute Details

#path=(value) ⇒ undefined (writeonly)

List of paths to measure

Returns:

  • (undefined)


18
19
20
# File 'lib/yardstick/rake/measurement.rb', line 18

def path=(value)
  @path = value
end

Instance Method Details

#output=(output) ⇒ undefined

The path to the file where the measurements will be written

Parameters:

  • output (String, Pathname)

    optional output path for measurements

Returns:

  • (undefined)


28
29
30
# File 'lib/yardstick/rake/measurement.rb', line 28

def output=(output)
  @output = Pathname(output)
end

#yardstick_measureundefined

Measure the documentation

Examples:

task.yardstick_measure  # (output measurement report)

Returns:

  • (undefined)


69
70
71
# File 'lib/yardstick/rake/measurement.rb', line 69

def yardstick_measure
  write_report { |io| Yardstick.measure(@path).puts(io) }
end