Guest User

Untitled

a guest
May 26th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #State,attribute
  2. #California,sunshine
  3. #California,beaches
  4. #Texas,oil
  5. #Texas,rock_festivals
  6.  
  7.  
  8. s = TableFu.new(csv)
  9. s.faceted_by("State").each do |state|
  10. puts state.row
  11. end
  12.  
  13. #or even better
  14.  
  15. s.faceted_by("State").each do |state|
  16. puts state.row['attribute']
  17. end
  18.  
  19.  
  20.  
  21. # This is the current api though:
  22. # I'm confused at what you'd wnat it to do
  23. #
  24. # when you facet you get tf instances not rows
  25. s = TableFu.new(csv)
  26. s.faceted_by("State").each do |state|
  27. state.rows.each do |row|
  28. puts row
  29. end
  30. end
  31.  
  32. # row[] is the hotness. I'll push a fix
  33. s.faceted_by("State").each do |state|
  34. state.rows.each do |row|
  35. puts state.row['attribute']
  36. end
  37. end
Add Comment
Please, Sign In to add comment