Method: DocStat::Container.from_sqlite
- Defined in:
- lib/docstat/container.rb
.from_sqlite(path) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/docstat/container.rb', line 24 def self.from_sqlite path db = SQLite3::Database.new(path) rows = has_return_values?(db) ? db.execute(QUERY_WITH_RETURN_VALUES) : db.execute(QUERY) container_groups = rows.group_by {|r| r.first } groups = container_groups.map do |name, tokens| self.new(name, tokens) end db.close groups end |