class DataAnon::Utils::TemplateHelper
Public Class Methods
destination_connection_specs_mongo()
click to toggle source
# File lib/utils/template_helper.rb, line 31 def self.destination_connection_specs_mongo ":mongodb_uri => '<enter value>', :database => '<enter value>'" end
destination_connection_specs_rdbms(config_hash)
click to toggle source
# File lib/utils/template_helper.rb, line 19 def self.destination_connection_specs_rdbms config_hash config_hash.keys.collect { |key| ":#{key} => '<enter_value>'" }.join ', ' end
mongo_uri(config_hash)
click to toggle source
# File lib/utils/template_helper.rb, line 35 def self.mongo_uri config_hash if config_hash[:user].nil? mongo_uri = "mongodb://#{config_hash[:host]}#{config_hash[:port].nil? ? "" : ":#{config_hash[:port]}"}/#{config_hash[:database]}" else credentials = "#{config_hash[:username]}:#{config_hash[:password]}" mongo_uri = "mongodb://#{config_hash[:host]}#{config_hash[:port].nil? ? "" : ":#{config_hash[:port]}"}@#{credentials}/#{config_hash[:database]}" end mongo_uri end
source_connection_specs_mongo(config_hash)
click to toggle source
# File lib/utils/template_helper.rb, line 27 def self.source_connection_specs_mongo config_hash ":mongodb_uri => '#{self.mongo_uri config_hash}', :database => '#{config_hash[:database]}'" end
source_connection_specs_rdbms(config_hash)
click to toggle source
# File lib/utils/template_helper.rb, line 5 def self.source_connection_specs_rdbms config_hash config_hash.keys.reject{|key| config_hash[key].nil? }.collect { |key| if ((config_hash[key].class.to_s.downcase == 'string')) ":#{key} => '#{config_hash[key]}'" elsif ((config_hash[key].class.to_s.downcase == 'integer')) ":#{key} => #{config_hash[key]}" elsif ((config_hash[key].class.to_s.downcase == 'fixnum')) ":#{key} => #{config_hash[key]}" end }.join ', ' end