imageaid/rails_service_generator

View on GitHub
lib/rails_services/nameable.rb

Summary

Maintainability
A
0 mins
Test Coverage
module RailsServices
  ##
  # commonly used naming conventions
  module Nameable
    def qualified_name
      name = "#{parent_name.pluralize.camelize}::"
      name += "#{options['sub_folder'].camelize}::" if options['sub_folder'].present?
      name += object_name.camelize.to_s
      name
    end

    def module_name
      parent_name.pluralize.camelize.to_s
    end

    def subfolder_name
      options['sub_folder'].try(:camelize).to_s
    end

    def service_class_name
      object_name.camelize.to_s
    end

    def form_class_name
      "#{object_name.camelize.to_s}Form"
    end
  end
end