Module: Synced::AttributesAsHash

Included in:
DelegateAttributes::ClassMethods, Strategies::Full
Defined in:
lib/synced/attributes_as_hash.rb

Instance Method Summary collapse

Instance Method Details

#synced_attributes_as_hash(attributes) ⇒ Object

On a Hash returns the same Hash On an Array returns a Hash with identical corresponding keys and values Used for mapping local - remote attributes



6
7
8
9
# File 'lib/synced/attributes_as_hash.rb', line 6

def synced_attributes_as_hash(attributes)
  return attributes if attributes.is_a?(Hash)
  Hash[Array.wrap(attributes).map { |name| [name, name] }]
end