Module: Gapic::Helpers::FilepathHelper
- Included in:
- Presenters::GemPresenter, Presenters::PackagePresenter, Presenters::ServicePresenter, Presenters::ServiceRestPresenter
- Defined in:
- lib/gapic/helpers/filepath_helper.rb
Overview
Helpers related to generating paths to ruby files (e.g. for require)
Instance Method Summary collapse
-
#fix_file_path(api, file_path) ⇒ Object
Corrects a namespace by replacing known bad values with good values.
-
#ruby_file_path(api, namespace) ⇒ Object
Converts a ruby namespace string to a file path string.
-
#ruby_file_path_for_namespace(namespace) ⇒ Object
Converts a ruby namespace string to a file path string.
Instance Method Details
#fix_file_path(api, file_path) ⇒ Object
Corrects a namespace by replacing known bad values with good values.
41 42 43 |
# 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) ⇒ Object
Converts a ruby namespace string to a file path string.
27 28 29 30 31 |
# 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) ⇒ Object
Converts a ruby namespace string to a file path string.
35 36 37 |
# File 'lib/gapic/helpers/filepath_helper.rb', line 35 def ruby_file_path_for_namespace namespace ActiveSupport::Inflector.underscore namespace end |