module Hashup
Public Instance Methods
hashup(*attributes)
click to toggle source
# File lib/hashup.rb, line 3 def hashup(*attributes) define_method(:to_h) do kv = attributes.map { |k| [k, send(k)] } .delete_if { |_k, v| v.nil? } Hash[kv] end end