Class: Agentilda::Linear::Attribution::Placed
- Inherits:
-
Data
- Object
- Data
- Agentilda::Linear::Attribution::Placed
- Defined in:
- lib/agentilda/linear/attribution.rb
Overview
One pull request, placed.
Instance Attribute Summary collapse
- #pull ⇒ Agentilda::PullRequest readonly
-
#rivals ⇒ Array<String>
readonly
Folders that matched equally well.
-
#score ⇒ Integer
readonly
Words the title and the folder name shared.
-
#subject ⇒ Agentilda::Subject?
readonly
Nil when nothing matched.
-
#widened ⇒ Object
readonly
Returns the value of attribute widened.
Instance Method Summary collapse
- #percent ⇒ String
- #placed? ⇒ Boolean
-
#source ⇒ String
Where the matching words came from.
- #why ⇒ String
Instance Attribute Details
#pull ⇒ Agentilda::PullRequest (readonly)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/agentilda/linear/attribution.rb', line 34 Placed = Data.define(:pull, :subject, :score, :rivals, :widened) do # @return [Boolean] def placed? = !subject.nil? # @return [String] def percent = "#{(score * 100).round}%" # @return [String] where the matching words came from def source = widened ? "title and description" : "title" # @return [String] def why return "matched no folder at all" if subject.nil? && score.zero? return "#{percent} of a folder name is not enough" if subject.nil? && rivals.empty? # `rivals` already holds every tied folder — there is no winner to # add back in, and `+ 1` here once reported a two-way tie as three. return "#{rivals.size} folders matched equally well (#{percent})" if subject.nil? "#{source}: covers #{percent} of the folder name" end end |
#rivals ⇒ Array<String> (readonly)
Returns folders that matched equally well.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/agentilda/linear/attribution.rb', line 34 Placed = Data.define(:pull, :subject, :score, :rivals, :widened) do # @return [Boolean] def placed? = !subject.nil? # @return [String] def percent = "#{(score * 100).round}%" # @return [String] where the matching words came from def source = widened ? "title and description" : "title" # @return [String] def why return "matched no folder at all" if subject.nil? && score.zero? return "#{percent} of a folder name is not enough" if subject.nil? && rivals.empty? # `rivals` already holds every tied folder — there is no winner to # add back in, and `+ 1` here once reported a two-way tie as three. return "#{rivals.size} folders matched equally well (#{percent})" if subject.nil? "#{source}: covers #{percent} of the folder name" end end |
#score ⇒ Integer (readonly)
Returns words the title and the folder name shared.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/agentilda/linear/attribution.rb', line 34 Placed = Data.define(:pull, :subject, :score, :rivals, :widened) do # @return [Boolean] def placed? = !subject.nil? # @return [String] def percent = "#{(score * 100).round}%" # @return [String] where the matching words came from def source = widened ? "title and description" : "title" # @return [String] def why return "matched no folder at all" if subject.nil? && score.zero? return "#{percent} of a folder name is not enough" if subject.nil? && rivals.empty? # `rivals` already holds every tied folder — there is no winner to # add back in, and `+ 1` here once reported a two-way tie as three. return "#{rivals.size} folders matched equally well (#{percent})" if subject.nil? "#{source}: covers #{percent} of the folder name" end end |
#subject ⇒ Agentilda::Subject? (readonly)
Returns nil when nothing matched.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/agentilda/linear/attribution.rb', line 34 Placed = Data.define(:pull, :subject, :score, :rivals, :widened) do # @return [Boolean] def placed? = !subject.nil? # @return [String] def percent = "#{(score * 100).round}%" # @return [String] where the matching words came from def source = widened ? "title and description" : "title" # @return [String] def why return "matched no folder at all" if subject.nil? && score.zero? return "#{percent} of a folder name is not enough" if subject.nil? && rivals.empty? # `rivals` already holds every tied folder — there is no winner to # add back in, and `+ 1` here once reported a two-way tie as three. return "#{rivals.size} folders matched equally well (#{percent})" if subject.nil? "#{source}: covers #{percent} of the folder name" end end |
#widened ⇒ Object (readonly)
Returns the value of attribute widened
34 35 36 |
# File 'lib/agentilda/linear/attribution.rb', line 34 def widened @widened end |
Instance Method Details
#percent ⇒ String
39 |
# File 'lib/agentilda/linear/attribution.rb', line 39 def percent = "#{(score * 100).round}%" |
#placed? ⇒ Boolean
36 |
# File 'lib/agentilda/linear/attribution.rb', line 36 def placed? = !subject.nil? |
#source ⇒ String
Returns where the matching words came from.
42 |
# File 'lib/agentilda/linear/attribution.rb', line 42 def source = widened ? "title and description" : "title" |
#why ⇒ String
45 46 47 48 49 50 51 52 53 |
# File 'lib/agentilda/linear/attribution.rb', line 45 def why return "matched no folder at all" if subject.nil? && score.zero? return "#{percent} of a folder name is not enough" if subject.nil? && rivals.empty? # `rivals` already holds every tied folder — there is no winner to # add back in, and `+ 1` here once reported a two-way tie as three. return "#{rivals.size} folders matched equally well (#{percent})" if subject.nil? "#{source}: covers #{percent} of the folder name" end |