lib/cultural_network/import/feature_data.rb
# ##################################################################### #
# create, save, and return the Feature object from this hpricot document
create, save, and return the Feature object from this hpricot document
create save and return the Feature object from this hpricot document
def extract_feature(doc)
      raise "extract_feature was passed an empty doc!" if doc.nil?
      pid = (doc/'/feature')[0].attributes['id']
      puts "extract_feature() -> pid = #{pid}"
      description = (doc/'/feature/fdesc').inner_html
      feature = Feature.find_or_create_by_pid(pid)
      feature.description = description.strip
      raise "Feature not saved!" unless feature.save
      return feature
    end
def extract_feature ( doc ) raise "extract_feature was passed an empty doc!" if doc . nil? pid = ( doc / '/feature' ) [ 0 ] . attributes [ 'id' ] puts "extract_feature() -> pid = #{pid}" description = ( doc / '/feature/fdesc' ) . inner_html feature = Feature . find_or_create_by_pid ( pid ) feature . description = description . strip raise "Feature not saved!" unless feature . save return feature end
create, save, and return the Feature object from this hpricot document
create save and return the Feature object from this hpricot document
#if(description) #end
doc
<not_specific>