class EacRubyUtils::Compact
def initialize(object, attributes)
def initialize(object, attributes) @object = object @attributes = attributes end
def to_a
-
(Array)
-
def to_a attributes.map { |attr| object.send(attr) } end
def to_h
-
(Hash)
-
def to_h attributes.map { |attr| [attr.to_sym, object.send(attr)] }.to_h end