lib/lc_discovery/models/base.rb
###
# A newly created base object will only have +lc_id+ populated, This method
# reads from a doc hash and fills in all the other attributes
#
# :: *doc* <Hash> probably generated from by an Extractor
A newly created base object will only have +lc_id+ populated, This method
reads from a doc hash and fills in all the other attributes

:: *doc*  probably generated from by an Extractor
A newly created base object will only have + lc_id + populated This method reads from a doc hash and fills in all the other attributes :: * doc * probably generated from by an Extractor
def populate(doc)
    Base.redis_objects.select{|k,v| v[:ilk] == :base}.each do |k,v|
      self.method("#{k}=").call(doc[k])
    end
    self.redis_objects.select{|k,v| v[:type] == :value && v[:ilk]}.each do |k,v|
      self.method("#{k}=").call(doc[k])
    end
    self.redis_objects.select{|k,v| v[:type] == :set}.each do |k,v|
      doc[k].each { |v| self.instance_eval("#{k}<<'#{v}'") }
    end
    self.lc_id = self.id
  end
def populate ( doc ) Base . redis_objects . select { | k , v | v [ :ilk ] == :base } . each do | k , v | self . method ( "#{k}=" ) . call ( doc [ k ] ) end self . redis_objects . select { | k , v | v [ :type ] == :value && v [ :ilk ] } . each do | k , v | self . method ( "#{k}=" ) . call ( doc [ k ] ) end self . redis_objects . select { | k , v | v [ :type ] == :set } . each do | k , v | doc [ k ] . each { | v | self . instance_eval ( "#{k}<<'#{v}'" ) } end self . lc_id = self . id end
A newly created base object will only have +lc_id+ populated, This method
reads from a doc hash and fills in all the other attributes
A newly created base object will only have + lc_id + populated This method reads from a doc hash and fills in all the other attributes
doc