Sha256: 10746bd2c39f201e82e7f1c484ddc84e59dc08abbb0a2292d95bbbb67eea2235

Contents?: true

Size: 295 Bytes

Versions: 2

Compression:

Stored size: 295 Bytes

Contents

module PluckJson
  def pluck_json(*column_names)
    names = column_names.presence || self.column_names

    pluck(*column_names).map! do |row|
      Hash[ names.zip([*row]) ]
    end
  end
end

module PluckJson::Delegation
  def self.included(base)
    delegate :pluck_json, to: :all
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pluck_json-0.1.1 lib/pluck_json/pluck_json.rb
pluck_json-0.1.0 lib/pluck_json/pluck_json.rb