Class: Yardstick::Rake::Measurement

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

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:



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

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)


16
17
18
# File 'lib/yardstick/rake/measurement.rb', line 16

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)


26
27
28
# File 'lib/yardstick/rake/measurement.rb', line 26

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

#yardstick_measureundefined

Measure the documentation

Examples:

task.yardstick_measure  # (output measurement report)

Returns:

  • (undefined)


67
68
69
# File 'lib/yardstick/rake/measurement.rb', line 67

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