Sha256: b5564ddd50db6b6e1b25d8d65d8731a0fa128b5db0048f9dbeaff7ff224dad3d

Contents?: true

Size: 375 Bytes

Versions: 26

Compression:

Stored size: 375 Bytes

Contents

module QuickTravel
  module InitFromHash
    def initialize(hash = {})
      return nil if hash.blank?

      hash.each do |attr, val|
        # set datamember of the object using hash key and value
        if respond_to?("#{attr}=")
          send("#{attr}=", val)
        else
          instance_variable_set("@#{attr}".to_sym, val)
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
quicktravel_client-1.1.2 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.6.1 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.6.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.5.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.4.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.3.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.2.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.1.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-3.0.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.9.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.8.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.7.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.6.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.5.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.4.1 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.4.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.3.1 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.3.0 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.2.2 lib/quick_travel/init_from_hash.rb
quicktravel_client-2.2.1 lib/quick_travel/init_from_hash.rb