Sha256: f2e2bb3ffc8fb6d58a1aeb18dc42879eb17236ab08f3507ec4b8a34ed49fd54e

Contents?: true

Size: 455 Bytes

Versions: 3

Compression:

Stored size: 455 Bytes

Contents

module Yinx
  module SQL
    class JsonBatch < ActiveRecord::Base
      def books
        batch.
          map { |note| [note['notebookGuid'], note['book']] }.
          uniq.
          map { |id_name| id_name[1] }
      end

      def stacks
        batch.
          map { |note| note['stack'] }.
          uniq
      end

      def tags
        batch.
          map { |note| note['tags'] }.
          flatten.
          uniq
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yinx_sql-0.1.2 lib/yinx_sql/json_batch.rb
yinx_sql-0.1.1 lib/yinx_sql/json_batch.rb
yinx_sql-0.1.0 lib/yinx_sql/json_batch.rb