Module: Fog::Google

Extended by:
Provider
Defined in:
lib/fog/google.rb,
lib/fog/google/sql.rb,
lib/fog/google/mock.rb,
lib/fog/google/pubsub.rb,
lib/fog/google/shared.rb,
lib/fog/google/version.rb,
lib/fog/google/sql/mock.rb,
lib/fog/google/sql/real.rb,
lib/fog/google/monitoring.rb,
lib/fog/google/pubsub/mock.rb,
lib/fog/google/pubsub/real.rb,
lib/fog/google/models/sql/flag.rb,
lib/fog/google/models/sql/tier.rb,
lib/fog/google/models/sql/user.rb,
lib/fog/google/monitoring/mock.rb,
lib/fog/google/monitoring/real.rb,
lib/fog/google/models/sql/flags.rb,
lib/fog/google/models/sql/tiers.rb,
lib/fog/google/models/sql/users.rb,
lib/fog/google/models/pubsub/topic.rb,
lib/fog/google/models/sql/instance.rb,
lib/fog/google/models/sql/ssl_cert.rb,
lib/fog/google/models/pubsub/topics.rb,
lib/fog/google/models/sql/instances.rb,
lib/fog/google/models/sql/operation.rb,
lib/fog/google/models/sql/ssl_certs.rb,
lib/fog/google/models/sql/backup_run.rb,
lib/fog/google/models/sql/operations.rb,
lib/fog/google/models/sql/backup_runs.rb,
lib/fog/google/requests/sql/list_flags.rb,
lib/fog/google/requests/sql/list_tiers.rb,
lib/fog/google/requests/sql/list_users.rb,
lib/fog/google/requests/sql/delete_user.rb,
lib/fog/google/requests/sql/insert_user.rb,
lib/fog/google/requests/sql/update_user.rb,
lib/fog/google/requests/pubsub/get_topic.rb,
lib/fog/google/requests/sql/get_instance.rb,
lib/fog/google/requests/sql/get_ssl_cert.rb,
lib/fog/google/models/pubsub/subscription.rb,
lib/fog/google/requests/sql/get_operation.rb,
lib/fog/google/models/pubsub/subscriptions.rb,
lib/fog/google/requests/pubsub/list_topics.rb,
lib/fog/google/requests/sql/clone_instance.rb,
lib/fog/google/requests/sql/get_backup_run.rb,
lib/fog/google/requests/sql/list_instances.rb,
lib/fog/google/requests/sql/list_ssl_certs.rb,
lib/fog/google/models/monitoring/timeseries.rb,
lib/fog/google/requests/pubsub/create_topic.rb,
lib/fog/google/requests/pubsub/delete_topic.rb,
lib/fog/google/requests/sql/delete_instance.rb,
lib/fog/google/requests/sql/delete_ssl_cert.rb,
lib/fog/google/requests/sql/export_instance.rb,
lib/fog/google/requests/sql/import_instance.rb,
lib/fog/google/requests/sql/insert_instance.rb,
lib/fog/google/requests/sql/insert_ssl_cert.rb,
lib/fog/google/requests/sql/list_operations.rb,
lib/fog/google/requests/sql/update_instance.rb,
lib/fog/google/requests/pubsub/publish_topic.rb,
lib/fog/google/requests/sql/list_backup_runs.rb,
lib/fog/google/requests/sql/restart_instance.rb,
lib/fog/google/models/pubsub/received_message.rb,
lib/fog/google/requests/sql/delete_backup_run.rb,
lib/fog/google/requests/sql/insert_backup_run.rb,
lib/fog/google/requests/pubsub/get_subscription.rb,
lib/fog/google/requests/pubsub/pull_subscription.rb,
lib/fog/google/requests/pubsub/list_subscriptions.rb,
lib/fog/google/models/monitoring/metric_descriptor.rb,
lib/fog/google/requests/monitoring/list_timeseries.rb,
lib/fog/google/requests/pubsub/create_subscription.rb,
lib/fog/google/requests/pubsub/delete_subscription.rb,
lib/fog/google/models/monitoring/metric_descriptors.rb,
lib/fog/google/requests/sql/restore_instance_backup.rb,
lib/fog/google/requests/monitoring/create_timeseries.rb,
lib/fog/google/requests/sql/reset_instance_ssl_config.rb,
lib/fog/google/models/monitoring/timeseries_collection.rb,
lib/fog/google/requests/pubsub/acknowledge_subscription.rb,
lib/fog/google/requests/monitoring/get_metric_descriptor.rb,
lib/fog/google/requests/monitoring/list_metric_descriptors.rb,
lib/fog/google/requests/monitoring/create_metric_descriptor.rb,
lib/fog/google/requests/monitoring/delete_metric_descriptor.rb,
lib/fog/google/models/monitoring/monitored_resource_descriptor.rb,
lib/fog/google/models/monitoring/monitored_resource_descriptors.rb,
lib/fog/google/requests/monitoring/get_monitored_resource_descriptor.rb,
lib/fog/google/requests/monitoring/list_monitored_resource_descriptors.rb

Defined Under Namespace

Modules: Shared Classes: Mock, Monitoring, Pubsub, SQL

Constant Summary collapse

VERSION =
"1.24.1".freeze

Class Method Summary collapse

Class Method Details

.escape(str, extra_exclude_chars = "") ⇒ Object

CGI.escape, but without special treatment on spaces



32
33
34
35
36
37
38
39
# File 'lib/fog/google.rb', line 32

def self.escape(str, extra_exclude_chars = "")
  # '-' is a special character inside a regex class so it must be first or last.
  # Add extra excludes before the final '-' so it always remains trailing, otherwise
  # an unwanted range is created by mistake.
  str.gsub(/([^a-zA-Z0-9_.#{extra_exclude_chars}-]+)/) do
    "%" + Regexp.last_match(1).unpack("H2" * Regexp.last_match(1).bytesize).join("%").upcase
  end
end