module Platformx::TextHelpers
Text helpers module @author Tim Mushen
Public Instance Methods
x_boolean_icon(value)
click to toggle source
Generate icon 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"
# File lib/platformx/text.rb, line 39 def x_boolean_icon(value) if !value.nil? && value == true str = "<i class='fa fa-check text-success'></i>" else str = "<i class='fa fa-ban text-danger'></i>" end return str end
x_boolean_label(value: "", type: "text")
click to toggle source
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"
# File lib/platformx/text.rb, line 20 def x_boolean_label(value: "", type: "text") if !value.nil? && value == true str = "Yes" else str = "No" end return str end
x_slug(slug: "")
click to toggle source
Generates slug from text @param slug [String] text to slug @return [String] slugged text
# File lib/platformx/text.rb, line 9 def x_slug(slug: "") return slug.slugify end