Module: TimeLineable

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

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#any_followings?Boolean

Returns:

  • (Boolean)

83
84
85
# File 'app/models/concerns/time_lineable.rb', line 83

def any_followings?
  followings.any?
end

#any_previous?Boolean

Returns:

  • (Boolean)

79
80
81
# File 'app/models/concerns/time_lineable.rb', line 79

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

#followingObject


70
71
72
# File 'app/models/concerns/time_lineable.rb', line 70

def following
  followings.order(started_at: :asc).first
end

#followingsObject


74
75
76
77
# File 'app/models/concerns/time_lineable.rb', line 74

def followings
  return nil unless started_at
  other_siblings.after(self.started_at)
end

#last_for_now?Boolean

Returns:

  • (Boolean)

87
88
89
# File 'app/models/concerns/time_lineable.rb', line 87

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

#previousObject


65
66
67
68
# File 'app/models/concerns/time_lineable.rb', line 65

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