Class: Yardstick::Processor
- Inherits:
-
Object
- Object
- Yardstick::Processor
- Defined in:
- lib/yardstick/processor.rb
Overview
Handle procesing a docstring or path of files
Class Method Summary collapse
-
.measurements ⇒ Yardstick::MeasurementSet
private
Measure method objects in YARD registry.
-
.method_objects ⇒ Array<YARD::CodeObjects::MethodObject>
private
Return method objects in YARD registry.
-
.process_path(path) ⇒ Yardstick::MeasurementSet
private
Measure files provided.
-
.process_string(string) ⇒ Yardstick::MeasurementSet
private
Measure string provided.
Class Method Details
.measurements ⇒ Yardstick::MeasurementSet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Measure method objects in YARD registry
42 43 44 45 46 47 48 |
# File 'lib/yardstick/processor.rb', line 42 def self.measurements measurements = MeasurementSet.new method_objects.each do |method_object| measurements.merge(method_object.docstring.measure) end measurements end |
.method_objects ⇒ Array<YARD::CodeObjects::MethodObject>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return method objects in YARD registry
56 57 58 59 60 61 62 |
# File 'lib/yardstick/processor.rb', line 56 def self.method_objects YARD::Registry.all(:method).sort_by do |method_object| [ method_object.file, method_object.line ] end ensure YARD::Registry.clear end |
.process_path(path) ⇒ Yardstick::MeasurementSet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Measure files provided
17 18 19 20 |
# File 'lib/yardstick/processor.rb', line 17 def self.process_path(path) YARD.parse(Array(path).map { |file| file.to_s }) measurements end |
.process_string(string) ⇒ Yardstick::MeasurementSet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Measure string provided
31 32 33 34 |
# File 'lib/yardstick/processor.rb', line 31 def self.process_string(string) YARD.parse_string(string.to_str) measurements end |