Module: Poms::HasAncestors::InstanceMethods

Defined in:
lib/poms/has_ancestors.rb

Instance Method Summary collapse

Instance Method Details

#ancestor_midsObject



29
30
31
32
33
34
# File 'lib/poms/has_ancestors.rb', line 29

def ancestor_mids
  return @ancestor_mids if @ancestor_mids
  descendant_of_mids = descendant_of.map(&:mid_ref) rescue []
  episode_of_mids = episode_of.map(&:mid_ref) rescue  []
  @ancestor_mids = (descendant_of_mids + episode_of_mids).flatten.compact.uniq
end

#serieObject



20
21
22
# File 'lib/poms/has_ancestors.rb', line 20

def serie
  series.first
end

#serie_midObject



24
25
26
27
# File 'lib/poms/has_ancestors.rb', line 24

def serie_mid
  return nil if serie.nil?
  serie.mid_ref || serie.mid
end

#seriesObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/poms/has_ancestors.rb', line 8

def series
  return @series if @series
  descendant_series = descendant_of.reject { |obj| obj.class != Poms::Series }
  if descendant_of.blank?
    []
  elsif descendant_series.blank?
    descendant_of
  else
    descendant_series
  end
end