summaryrefslogtreecommitdiff
path: root/app/models/license_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/license_status.rb')
-rw-r--r--app/models/license_status.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/license_status.rb b/app/models/license_status.rb
index 41b54c5..d5da68f 100644
--- a/app/models/license_status.rb
+++ b/app/models/license_status.rb
@@ -2,10 +2,15 @@ class LicenseStatus
ACTIVE=Active.new
EXPIRED=Expired.new
CONFIDENTIAL=Confidential.new
+ UNKNOWN=Object.new
ALL=[ACTIVE, EXPIRED, CONFIDENTIAL]
def self.find_match(status = "")
ALL.find { |x| x.matches?("#{status}".downcase) } || ACTIVE
end
+
+ def self.status_for(license)
+ ALL.find { |x| x.best_represents?(license) } || UNKNOWN
+ end
end