class Yardstick::Document
Wraps a yard docstring to make a nicer interface
def self.measure(document, config)
- Api: - private
Returns:
-
(MeasurementSet)
-
Parameters:
-
config
(Yardstick::Config
) -- -
document
(Yardstring::Document
) --
def self.measure(document, config) MeasurementSet.new( registered_rules.map do |rule_class| Measurement.new(rule_class.coerce(document, config)) end ) end
def self.register_rule(rule_class)
- Api: - private
Returns:
-
(undefined)
-
Parameters:
-
rule_class
(Class
) --
def self.register_rule(rule_class) registered_rules << rule_class end
def api?(types)
- Api: - private
Returns:
-
(Boolean)
-
Parameters:
-
types
(Array
) --
def api?(types) types.include?(tag_text('api')) end
def file
- Api: - private
Returns:
-
(Pathname)
-
def file Pathname(object.file) end
def has_tag?(name) # rubocop:disable PredicateName
- Api: - private
Returns:
-
(Boolean)
-
Parameters:
-
name
(String
) --
def has_tag?(name) # rubocop:disable PredicateName @docstring.has_tag?(name) end
def initialize(docstring)
- Api: - private
Returns:
-
(undefined)
-
Parameters:
-
(
Yard::Docstring
) --
def initialize(docstring) @docstring = docstring end
def line
- Api: - private
Returns:
-
(Integer)
-
def line object.line end
def object
- Api: - private
Returns:
-
(YARD::CodeObjects::Base)
-
def object @docstring.object end
def path
- Api: - private
Returns:
-
(String)
-
def path object.path end
def summary_text
- Api: - private
Returns:
-
(String)
-
def summary_text @docstring.split(/\r?\n\r?\n/).first.to_s end
def tag(name)
- Api: - private
Returns:
-
(YARD::Tags::Tag, NullTag)
-
Parameters:
-
name
(String
) --
def tag(name) @docstring.tag(name) || NullTag.new end
def tag_text(tag_name)
- Api: - private
Returns:
-
(String, nil)
-
Parameters:
-
tag_name
(String
) --
def tag_text(tag_name) tag(tag_name).text end
def tag_types(tag_name)
- Api: - private
Returns:
-
(Array
-)
Parameters:
-
tag_name
(String
) --
def tag_types(tag_name) tag(tag_name).types end
def visibility
- Api: - private
Returns:
-
(Symbol)
-
def visibility object.visibility end