Module: VendorSuppliers::RestaurantHumanizer
- Extended by:
- ActiveSupport::Concern
- Included in:
- BistrochatRestaurant, MyMenuRestaurant, SevenRoomsRestaurant, TablecheckRestaurant, WeeloyRestaurant
- Defined in:
- app/models/concerns/vendor_suppliers/restaurant_humanizer.rb
Overview
RestaurantHumanizer Concern
This concern is designed for vendor-supplier restaurant models (e.g., TablecheckRestaurant, and provides a standardized way to extract a human-readable identifier from the model class name.
Purpose:
To allow vendor-specific restaurant classes to be referenced with a clean, lowercase string identifier, often useful for error messages, logs, labels, or vendor-specific logic.
For example:
TablecheckRestaurant.humanize # => "tablecheck"
BistrochatRestaurant.humanize # => "bistrochat"
MyMenuRestaurant.humanize # => "mymenu"
WeeloyRestaurant.humanize # => "weeloy"
Usage:
Include this concern in any vendor-supplier-specific model class that ends with “Restaurant”:
class TablecheckRestaurant < ApplicationRecord
include VendorSuppliers::RestaurantHumanizer
end
Expected Class Name Format:
The class should follow the naming convention: `VendorNameRestaurant` The `humanize` method strips the `_restaurant` suffix and converts the remaining part to snake_case.
"TablecheckRestaurant" → "tablecheck"