Sha256: c904db1f33f51b30127254f5d7074dac77cef8f8194cfb2da798d47767707a7c
Contents?: true
Size: 574 Bytes
Versions: 5
Compression:
Stored size: 574 Bytes
Contents
require "active_support/core_ext/hash" module HubLink class Slicer def initialize(record, columns: []) @record = record @columns = columns end def to_h normalized_attributes.with_indifferent_access end private attr_reader :record, :columns def normalized_attributes raw_attributes.transform_keys { |key| key.to_s.chomp("?").to_sym } end def raw_attributes columns.inject({}) do |result, column| result.merge(column => record.public_send(column)) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems