Sha256: 82de352079ecc4200bea1460dae6f20b500ad135ccfb339e65caa74e9b98586e

Contents?: true

Size: 614 Bytes

Versions: 20

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

module Motor
  module BuildSchema
    module Utils
      ABBREVIATIONS = {
        'id' => 'ID',
        'url' => 'URL',
        'iso' => 'ISO',
        'vip' => 'VIP',
        'ip' => 'IP',
        'zip' => 'ZIP'
      }.freeze

      module_function

      def slugify(model)
        model.name.underscore.pluralize.gsub('/', '__')
      end

      def classify_slug(slug)
        slug.singularize.gsub('__', '/').classify.constantize
      end

      def humanize_column_name(column_name)
        ABBREVIATIONS.fetch(column_name, column_name.humanize)
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
motor-admin-0.1.66 lib/motor/build_schema/utils.rb
motor-admin-0.1.65 lib/motor/build_schema/utils.rb
motor-admin-0.1.64 lib/motor/build_schema/utils.rb
motor-admin-0.1.63 lib/motor/build_schema/utils.rb
motor-admin-0.1.62 lib/motor/build_schema/utils.rb
motor-admin-0.1.61 lib/motor/build_schema/utils.rb
motor-admin-0.1.60 lib/motor/build_schema/utils.rb
motor-admin-0.1.58 lib/motor/build_schema/utils.rb
motor-admin-0.1.57 lib/motor/build_schema/utils.rb
motor-admin-0.1.56 lib/motor/build_schema/utils.rb
motor-admin-0.1.55 lib/motor/build_schema/utils.rb
motor-admin-0.1.54 lib/motor/build_schema/utils.rb
motor-admin-0.1.53 lib/motor/build_schema/utils.rb
motor-admin-0.1.52 lib/motor/build_schema/utils.rb
motor-admin-0.1.51 lib/motor/build_schema/utils.rb
motor-admin-0.1.50 lib/motor/build_schema/utils.rb
motor-admin-0.1.49 lib/motor/build_schema/utils.rb
motor-admin-0.1.48 lib/motor/build_schema/utils.rb
motor-admin-0.1.47 lib/motor/build_schema/utils.rb
motor-admin-0.1.46 lib/motor/build_schema/utils.rb