Skip to content

Commit

Permalink
Refactor Yardstick::Document to use concord
Browse files Browse the repository at this point in the history
  • Loading branch information
John Backus committed Oct 4, 2015
1 parent 21bd987 commit 25a8676
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion config/flay.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
threshold: 9
total_score: 172
total_score: 175
23 changes: 7 additions & 16 deletions lib/yardstick/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,14 @@ def self.measure(document, config)
)
end

# @!attribute [r] docstring
#
# Return document yard docstring
#
# @return [YARD::Docstring]
#
# @api private
attr_reader :docstring

# Initializes Document object with docstring
#
# @param [Yard::Docstring]
#
# @return [undefined]
#
# @api private
def initialize(docstring)
@docstring = docstring
end
include Concord::Public.new(:docstring)

# The raw text for the summary
#
Expand All @@ -69,7 +60,7 @@ def initialize(docstring)
#
# @api private
def summary_text
@docstring.split(/\r?\n\r?\n/).first.to_s
docstring.split(/\r?\n\r?\n/).first.to_s
end

# Tests if document has a tag
Expand All @@ -82,7 +73,7 @@ def summary_text
#
# @api private
def has_tag?(name) # rubocop:disable PredicateName
@docstring.has_tag?(name)
docstring.has_tag?(name)
end

# The text for a specified tag
Expand Down Expand Up @@ -173,7 +164,7 @@ def path
#
# @api private
def object
@docstring.object
docstring.object
end

# Finds tag by tag name
Expand All @@ -185,7 +176,7 @@ def object
#
# @api private
def tag(name)
@docstring.tag(name) || NullTag.new
docstring.tag(name) || NullTag.new
end

# Null object for YARD::Tags::Tag
Expand Down

0 comments on commit 25a8676

Please sign in to comment.