Module: TimeLineable

Extended by:
ActiveSupport::Concern
Included in:
ProductEnjoyment, ProductLink, ProductLinkage, ProductLocalization, ProductMembership, ProductMovement, ProductOwnership, ProductPhase, TargetDistribution
Defined in:
app/models/concerns/time_lineable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#any_followings?Boolean


85
86
87
# File 'app/models/concerns/time_lineable.rb', line 85

def any_followings?
  followings.any?
end

#any_previous?Boolean


81
82
83
# File 'app/models/concerns/time_lineable.rb', line 81

def any_previous?
  other_siblings.before(self.started_at).any?
end

#followingObject


72
73
74
75
# File 'app/models/concerns/time_lineable.rb', line 72

def following
  return nil unless stopped_at
  followings.order(started_at: :asc).first
end

#followingsObject


77
78
79
# File 'app/models/concerns/time_lineable.rb', line 77

def followings
  other_siblings.after(self.started_at)
end

#last_for_now?Boolean


89
90
91
# File 'app/models/concerns/time_lineable.rb', line 89

def last_for_now?
  followings.before(Time.zone.now).empty?
end

#previousObject


67
68
69
70
# File 'app/models/concerns/time_lineable.rb', line 67

def previous
  return nil unless self.started_at
  other_siblings.before(self.started_at).order(started_at: :desc).first
end