Sha256: 5a91ccef89c22d5ca348beaef8bc98b3d84abbdb192486d7133ac13d7e5ca668

Contents?: true

Size: 1.16 KB

Versions: 32

Compression:

Stored size: 1.16 KB

Contents

# Encoding: utf-8
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Utility that generates up resource names for entities given IDs.

module Google
  module Ads
    module GoogleAds
      module Utils
        # Takes a string and converts it from snake case to camel case. e.g:
        # foo_service becomes FooService
        def self.camelize(string)
          string.to_str.split("_").map(&:capitalize).join
        end

        def self.underscore(string)
          string.to_str.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
            gsub(/([a-z\d])([A-Z])/,'\1_\2').
            tr("-", "_").
            downcase
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
google-ads-googleads-16.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-15.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-14.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-13.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-12.0.2 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-12.0.1 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-11.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-10.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-9.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-8.1.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-8.0.0 lib/google/ads/google_ads/utils/string_utils.rb
google-ads-googleads-7.0.0 lib/google/ads/google_ads/utils/string_utils.rb