Sha256: fe01fe4123b73f2f02ec7e7f800af84732207f0f00a02214e1edd3bef8fe6f2a
Contents?: true
Size: 988 Bytes
Versions: 7
Compression:
Stored size: 988 Bytes
Contents
module Poms module HasAncestors module ClassMethods end module InstanceMethods 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 def serie series.first end def serie_mid return nil if serie.nil? serie.mid_ref || serie.mid end 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 end def self.included(receiver) receiver.extend ClassMethods receiver.send :include, InstanceMethods end end end
Version data entries
7 entries across 7 versions & 1 rubygems