module Gapic::Helpers::FilepathHelper

Helpers related to generating paths to ruby files (e.g. for require)

Public Instance Methods

fix_file_path(api, file_path) click to toggle source

Corrects a namespace by replacing known bad values with good values.

# File lib/gapic/helpers/filepath_helper.rb, line 41
def fix_file_path api, file_path
  file_path.split("/").map { |node| api.fix_file_path node }.join("/")
end
ruby_file_path(api, namespace) click to toggle source

Converts a ruby namespace string to a file path string.

# File lib/gapic/helpers/filepath_helper.rb, line 27
def ruby_file_path api, namespace
  namespace = namespace.sub(/^::/, "")
  file_path = ruby_file_path_for_namespace namespace
  fix_file_path api, file_path
end
ruby_file_path_for_namespace(namespace) click to toggle source

Converts a ruby namespace string to a file path string.

# File lib/gapic/helpers/filepath_helper.rb, line 35
def ruby_file_path_for_namespace namespace
  ActiveSupport::Inflector.underscore namespace
end