Sha256: 306e41a521e6f788e3b936a58650c3288b923f1afe57994a9892de8daa840592
Contents?: true
Size: 743 Bytes
Versions: 9
Compression:
Stored size: 743 Bytes
Contents
# frozen_string_literal: true module AnnotateRb module ModelAnnotator class FileNameResolver class << self def call(filename_template, model_name, table_name) # e.g. with a model file name like "app/models/collapsed/example/test_model.rb" # and using a collapsed `model_name` such as "collapsed/test_model" model_name_without_namespace = model_name.split("/").last filename_template .gsub("%MODEL_NAME%", model_name) .gsub("%MODEL_NAME_WITHOUT_NS%", model_name_without_namespace) .gsub("%PLURALIZED_MODEL_NAME%", model_name.pluralize) .gsub("%TABLE_NAME%", table_name || model_name.pluralize) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems