Module: Yardstick

Defined in:
lib/yardstick.rb,
lib/yardstick/cli.rb,
lib/yardstick/rule.rb,
lib/yardstick/method.rb,
lib/yardstick/version.rb,
lib/yardstick/rule_set.rb,
lib/yardstick/processor.rb,
lib/yardstick/measurable.rb,
lib/yardstick/measurement.rb,
lib/yardstick/ordered_set.rb,
lib/yardstick/rake/verify.rb,
lib/yardstick/measurement_set.rb,
lib/yardstick/rake/measurement.rb

Defined Under Namespace

Modules: Measurable, Method, Rake Classes: CLI, Measurement, MeasurementSet, OrderedSet, Processor, Rule, RuleSet

Constant Summary collapse

ROOT =
Pathname(__FILE__).dirname.parent.expand_path.freeze
VERSION =

Gem version

'0.9.6'.freeze

Class Method Summary collapse

Class Method Details

.measure(path = 'lib/**/*.rb', options = {}) ⇒ Yardstick::MeasurementSet

Measure a list of files

Examples:

Yardstick.measure('article.rb')  # => [ Measurement ]

Parameters:

  • path (Array<#to_s>, #to_s) (defaults to: 'lib/**/*.rb')

    optional list of paths to measure

  • options (Hash) (defaults to: {})

    optional configuration

Returns:



41
42
43
# File 'lib/yardstick.rb', line 41

def self.measure(path = 'lib/**/*.rb', options = {})
  Processor.process_path(path)
end

.measure_string(string, options = {}) ⇒ Yardstick::MeasurementSet

Measure a string of code and YARD documentation

Examples:

string = "def my_method; end"

Yardstick.measure_string(string)  # => [ Measurement ]

Parameters:

  • string (#to_str)

    the string to measure

  • options (Hash) (defaults to: {})

    optional configuration

Returns:



61
62
63
# File 'lib/yardstick.rb', line 61

def self.measure_string(string, options = {})
  Processor.process_string(string)
end