Class: Rubyists::Linear::Project

Inherits:
Object
  • Object
show all
Includes:
SemanticLogger::Loggable
Defined in:
lib/linear/models/project.rb

Overview

The Project class represents a Linear workflow state.

Constant Summary collapse

Base =
fragment('BaseProject', 'Project') do
  id
  name
  content
  slugId
  description
  url
  createdAt
  updatedAt
end

Instance Method Summary collapse

Instance Method Details

#inspectionObject



42
43
44
# File 'lib/linear/models/project.rb', line 42

def inspection
  format('name: "%<name>s" type: "%<url>s"', name:, url:)
end

#match_score?(string) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
# File 'lib/linear/models/project.rb', line 29

def match_score?(string)
  downed = string.downcase
  return 100 if downed.split.join('-') == slug || downed == name.downcase
  return 75 if name.include?(string) || slug.include?(downed)
  return 50 if description.downcase.include?(downed)

  0
end

#slugObject



25
26
27
# File 'lib/linear/models/project.rb', line 25

def slug
  File.basename(url).sub("-#{slugId}", '')
end

#to_sObject



38
39
40
# File 'lib/linear/models/project.rb', line 38

def to_s
  format('%<name>-12s %<url>s', name:, url:)
end