Module: MyFeeds::Identity::ClassMethods

Defined in:
lib/my_feeds/identity.rb

Instance Method Summary collapse

Instance Method Details

#feed_polymorphicObject


12
13
14
# File 'lib/my_feeds/identity.rb', line 12

def feed_polymorphic
  @_feed_polymorphic
end

#init_feeds_polymorphic(polymorphic) ⇒ Object


16
17
18
19
20
21
22
23
24
# File 'lib/my_feeds/identity.rb', line 16

def init_feeds_polymorphic polymorphic
  @_feed_polymorphic = polymorphic
  class_eval %Q{
    def save_feed_identity
      self.#{polymorphic_identity_column} = "#\{#{polymorphic_id_column}.to_s\}:#\{#{polymorphic_type_column}.to_s.underscore\}"
    end
    protected :save_feed_identity
  }
end

#polymorphic_id_columnObject


30
31
32
# File 'lib/my_feeds/identity.rb', line 30

def polymorphic_id_column
  :"#{feed_polymorphic}_id"
end

#polymorphic_identity_columnObject


26
27
28
# File 'lib/my_feeds/identity.rb', line 26

def polymorphic_identity_column
  :"#{feed_polymorphic}_identity"
end

#polymorphic_type_columnObject


34
35
36
# File 'lib/my_feeds/identity.rb', line 34

def polymorphic_type_column
  :"#{feed_polymorphic}_type"
end