Sha256: 5a480fa3bcdedc5db540b8a8004bf472ab7bb563a23829a24fb44e78957e0c52

Contents?: true

Size: 442 Bytes

Versions: 4

Compression:

Stored size: 442 Bytes

Contents

# frozen_string_literal: true

module GhostRb
  # Provides utility classes and modules extensions for GhostRb
  # @author Rene Hernandez
  # @since 0.2.3
  module Support
    # @author Rene Hernandez
    # @since 0.1
    module Hydratable
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ghost_rb-0.3.0 lib/ghost_rb/support/hydratable.rb
ghost_rb-0.2.8 lib/ghost_rb/support/hydratable.rb
ghost_rb-0.2.7 lib/ghost_rb/support/hydratable.rb
ghost_rb-0.2.6 lib/ghost_rb/support/hydratable.rb