Module: GhostRb::Support::Hydratable

Included in:
Resources::BaseResource
Defined in:
lib/ghost_rb/support/hydratable.rb

Overview

Author:

  • Rene Hernandez

Since:

  • 0.1

Instance Method Summary collapse

Instance Method Details

#hydrate(hash) ⇒ Object

Since:

  • 0.1



11
12
13
14
15
16
# File 'lib/ghost_rb/support/hydratable.rb', line 11

def hydrate(hash)
  hash.each do |k, v|
    method_symbol = "#{k}=".to_sym
    public_send(method_symbol, v) if respond_to?(method_symbol)
  end
end