Class: Archangel::Entry

Inherits:
ApplicationRecord show all
Defined in:
app/models/archangel/entry.rb

Overview

Entry model

Instance Method Summary collapse

Instance Method Details

#available?Boolean

Check if Entry is available. Available in the past, present and future. Future availability date is also considered available.

Returns:

  • (Boolean)

    if available



28
29
30
# File 'app/models/archangel/entry.rb', line 28

def available?
  available_at.present?
end

#statusString

Return string of availability status.

Returns:

  • (String)

    available status



37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/archangel/entry.rb', line 37

def status
  if available?
    if available_at > Time.now
      "future-available"
    else
      "available"
    end
  else
    "unavailable"
  end
end