summaryrefslogtreecommitdiff
path: root/app/models/license_status/active.rb
blob: 63a9b00df7d435d3620e350917c203c2a3ebaa30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class LicenseStatus::Active
  def filter(licenses)
    now = DateTime.now
    licenses.where('issued_at < ? AND expired_at > ?', now, now)
  end

  def matches?(name)
    to_s == name
  end

  def best_represents?(license)
    license.active_on?(DateTime.now)
  end

  def to_s
    'active'
  end
end