module Platformx # Text helpers module # @author Tim Mushen module TextHelpers # Generates slug from text # @param slug [String] text to slug # @return [String] slugged text def x_slug(slug: "") return slug.slugify end # Generate boolean label # @param value [Boolean] boolean value # @param type [String] boolean label type # @return [String] boolean label (yes or no for boolean value) # @example # x_boolean_label(true) # -> "Yes" # x_boolean_label(false) # -> "No" def x_boolean_label(value: "", type: "text") if !value.nil? && value == true str = "Yes" else str = "No" end return str end end end