Module: Wuclan::Models::StructToSQL

Defined in:
lib/wuclan/metrics/user_metrics.rb

Overview

1 rsrc 2 id 3 screen_name 4protect 5 age 6duratio 7age_use 8age_las 9 fo 10fr 11 tw 12 fv 13 fr_fo 14 fo_week 15 fr_week 16 tw_day 17 fv_mo 18fo_sampled 19fr_sampled 20tw_sampled 21tw_rece 22tw_day_ 23at_in_s 24at_out_ 25rt_in_s 26rt_out_ 27fv_in_s 28fv_out_ 29any_wit 30any_out 31any_in_ 32at_in_w 33at_out_ 34rt_in_w 35rt_out_ 36fv_in_w 37fv_out_ 38at_tw_o 39rt_tw_o 40rt_at_o 41at_in_t 42rt_in_t 43rt_at_i 44 reach 45fo_cove 46fr_cove 47tw_cove 48fv_cove 49scrape_ 50scrape_ 51scrape_ 52 scraped_at 53part_scraped_at 54 created_at 55 last_tw_at

Instance Method Summary collapse

Instance Method Details

#to_sql_strObject



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/wuclan/metrics/user_metrics.rb', line 90

def to_sql_str
  members.zip(mtypes, mnames).each do |attr, type, name|
    type_str = case
               when type <= String then  'VARCHAR(255) CHARACTER SET ASCII'
               when type <= Enum   then  type.to_sql_str
               else type.to_s.upcase
               end
    puts "  %-23s\t%-23s\t-- %s" %["`#{attr}`", type_str+',', name]
  end
  [ UserMetrics.members.map{|attr| "`#{attr}`" }.join(", ") ]
end