Sha256: 8fb78fc4010e70a4cceb949cdc8316bb3073254592799ee09eb8586eef8b82ce
Contents?: true
Size: 419 Bytes
Versions: 2
Compression:
Stored size: 419 Bytes
Contents
# frozen_string_literal: true module EacRubyUtils class Compact attr_reader :object, :attributes def initialize(object, attributes) @object = object @attributes = attributes end # @return [Array] def to_a attributes.map { |attr| object.send(attr) } end # @return [Hash] def to_h attributes.to_h { |attr| [attr.to_sym, object.send(attr)] } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
eac_ruby_utils-0.121.0 | lib/eac_ruby_utils/compact.rb |
eac_ruby_utils-0.120.0 | lib/eac_ruby_utils/compact.rb |