Method: Jinx::Mergeable#value_hash

Defined in:
lib/jinx/resource/mergeable.rb

#value_hash(attributes = nil) ⇒ {Symbol => Object}

Returns an attribute => value hash for the specified attributes with a non-nil, non-empty value. The default attributes are this domain object’s class Propertied#attributes. Only non-nil values of attributes defined by this domain object are included in the result hash.

Parameters:

  • attributes (<Symbol>, nil) (defaults to: nil)

    the attributes to merge

Returns:



108
109
110
111
# File 'lib/jinx/resource/mergeable.rb', line 108

def value_hash(attributes=nil)
  attributes ||= self.class.attributes
  attributes.to_compact_hash { |pa| send(pa) rescue nil }
end