module Lifetime

Constants

VERSION

Public Instance Methods

lifetime() click to toggle source
# File lib/lifetime.rb, line 61
def lifetime
  lifetime_start_at..lifetime_end_at
end
lifetime_active?(time = Time.now) click to toggle source
# File lib/lifetime.rb, line 33
def lifetime_active?(time = Time.now)
  lifetime_start_at <= time && lifetime_end_at >= time
end
lifetime_end_at() click to toggle source
# File lib/lifetime.rb, line 29
def lifetime_end_at
  send(self.class.lifetime_end_field)
end
lifetime_expired?(time = Time.now) click to toggle source
# File lib/lifetime.rb, line 41
def lifetime_expired?(time = Time.now)
  lifetime_end_at < time
end
lifetime_future?(time = Time.now) click to toggle source
# File lib/lifetime.rb, line 45
def lifetime_future?(time = Time.now)
  lifetime_start_at > time
end
lifetime_inactive?(time = Time.now) click to toggle source
# File lib/lifetime.rb, line 37
def lifetime_inactive?(time = Time.now)
  !lifetime_active?
end
lifetime_last_expired(time = Time.now) click to toggle source
# File lib/lifetime.rb, line 53
def lifetime_last_expired(time = Time.now)
  self.class.lifetime_expired(time).first
end
lifetime_next_future(time = Time.now) click to toggle source
# File lib/lifetime.rb, line 49
def lifetime_next_future(time = Time.now)
  self.class.lifetime_future(time).first
end
lifetime_overlaps?(another) click to toggle source
# File lib/lifetime.rb, line 57
def lifetime_overlaps?(another)
  lifetime.overlaps? another.lifetime
end
lifetime_start_at() click to toggle source
# File lib/lifetime.rb, line 25
def lifetime_start_at
  send(self.class.lifetime_start_field)
end