Sha256: ed0d7f6685a48f750b28b242c70a8e7d7794e347b3653cd52858357b2dde2d13
Contents?: true
Size: 632 Bytes
Versions: 2
Compression:
Stored size: 632 Bytes
Contents
module PluckMap module HashPresenter def self.included(base) def base.to_h(query, **kargs) new(query).to_h(**kargs) end end def to_h define_to_h! to_h end private def define_to_h! ruby = <<-RUBY def to_h pluck do |results| results.map { |values| values = Array(values); { #{attributes.map { |attribute| "#{attribute.name.inspect} => #{attribute.to_ruby}" }.join(", ")} } } end end RUBY # puts "\e[34m#{ruby}\e[0m" # <-- helps debugging PluckMapPresenter class_eval ruby, __FILE__, __LINE__ - 7 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pluck_map-2.0.0 | lib/pluck_map/presenters/to_h.rb |
pluck_map-2.0.0.rc1 | lib/pluck_map/presenters/to_h.rb |