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:



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

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)


20
21
22
# File 'lib/yardstick/rake/measurement.rb', line 20

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)


30
31
32
# File 'lib/yardstick/rake/measurement.rb', line 30

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

#yardstick_measureundefined

Measure the documentation

Examples:

task.yardstick_measure  # (output measurement report)

Returns:

  • (undefined)


71
72
73
# File 'lib/yardstick/rake/measurement.rb', line 71

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