You can use all standard Liquid filters in Insites. Aside from these, you can also use Insites - specific Liquid filters.
add_to_time
Returns: Time - modified time
Params
- time (StringIntegerDateTime)
- number (Integer) - default: 1
- unit (String) - time unit - allowed options are: y, years, mo, months, w, weeks, d [default], days, h, hours, m, minutes, s, seconds - default: 'd'
Examples
advanced_format
Returns: String - formatted string
Params
- argument_to_format (Object) - object you want to format
- format (String) - should look like: %[flags][width][.precision]type. For more examples and information, see: https://ruby-doc.org/core-2.5.1/Kernel.html#method-i-sprintf
Examples
amount_to_fractional
Converts amount in given currency to fractional. For example, convert USD to cents.
Returns: Integer - Amount in fractional, for example, cents for USD
Params
- amount (NumericString) - amount to be changed to fractional
- currency (String) - currency to be used - default: 'USD'
Examples
array_add (aliases: add_to_array)
Returns: Array<Object> - array to which you add the item given as the second parameter
Params
- array (Array<Object>) - array to which you add a new element
- item (Object) - the item you add to the array
Examples
array_any (aliases: any)
Returns: Boolean - checks if the given array contains at least one of the queried string/number.
Params
- array (Array) - array to search in - default: []
- query (StringNumber) - String/Number compared to each item in the given array - default: 'true'
Examples
array_compact (aliases: compact)
Returns: Array<Object> - array from which blank values are removed
Params
- array (Array<Object>) - array with some blank values
- property (String) - optionally if you provide Array<hash> as argument, you can remove elements which given key is blank</hash> - default: nil
Examples
array_detect (aliases: detect)
Returns: Object - first object from the collection that matches the specified conditions
Params
- objects (Array<Object>) - an array of objects to be processed
- conditions (Hash) - hash with conditions { field_name: value } - default: {}
Examples
array_find_index
Returns: Array<Integer> - with indices from a collection that matches provided conditions
Params
- objects (Array<Object>) - an array of objects to be processed
- conditions (Hash) - hash with conditions { field_name: value }
Examples
array_flatten (aliases: flatten)
Returns: Array<Object> - with objects
Params
- array (Array<Array>) - an array of arrays to be processed
Examples
array_group_by (aliases: group_by)
Returns: Hash<MethodResult => Array<Object>> - the original array grouped by method specified by the second parameter
Params
- objects (Array<Object>) - array to be grouped
- method_name (String) - method name to be used to group Objects
Examples
array_in_groups_of (aliases: in_groups_of)
Returns: Array<Array<Object>> - the original array split into groups of the size specified by the second parameter (an array of arrays)
Params
- array (Array<Object>) - array to be split into groups
- integer (Integer) - the size of each group the array is to be split into
Examples
array_include (aliases: is_included_in_array)
Returns: Boolean - whether the array includes the element given
Params
- array (Array) - an array of elements to look into
- el (Object) - look for this element inside the array
array_index_of
Returns: - Integer position of the object in the array if found or nil otherwise
Params
- array (Array<Object>) - an array of objects to be processed
- object (Object) - object to search for
Examples
array_intersect (aliases: intersection)
Returns: Array<Object> - that exists in both arrays
Params
- array (Array<Object>) - an array of objects to be processed
- other_array (Array<Object>) - an array of objects to be processed
Examples
array_limit (aliases: limit)
Returns: Array<Object> - parameter; [1,2,3,4] limited to 2 elements gives [1,2]
Params
- array (Array<Object>) - array to shrink
- limit (Integer) - number of elements to be returned
Examples
array_map (aliases: map_attributes)
Returns: Array<Array> - an array of arrays with values for given keys
Params
- array (Array<Hash>) - an array of objects to be processed
- attributes (Array<String>>) - an array of keys to be extracted
Examples
array_prepend (aliases: prepend_to_array)
Returns: Array<Object> - array to which you prepend the item given as the second parameter
Params
- array (Array<Object>) - array to which you prepend a new element
- item (Object) - an item you prepend to the array
Examples
array_reject (aliases: reject)
Returns: Array<Object> - with objects from collection that don't match provided conditions
Params
- objects (Array<Object>) - an array of objects to be processed
- conditions (Hash) - hash with conditions { field_name: value } - default: {}
Examples
array_rotate (aliases: rotate)
Returns: Array<Object> - the input array rotated by a number of times given as the second parameter; [1,2,3,4] rotated by 2 gives [3,4,1,2]
Params
- array (Array<Object>) - array to be rotated
- count (Integer) - number of times to rotate the input array - default: 1
Examples
array_select (aliases: select)
Returns: Array<Object> - with objects from collection that matches provided conditions
Params
- objects (Array<Object>) - an array of objects to be processed
- conditions (Hash) - hash with conditions { field_name: value } - default: {}
Examples
array_shuffle (aliases: shuffle_array)
Returns: Array<Array> - array with shuffled items
Params
- array (Array<Object>) - an array of objects to be processed
Examples
array_sort_by (aliases: sort_by)
Returns: Array - The sorted object (Array of Hash)
Params
- input (Array) - Array of Hash to be sorted by a key
- property (Object) - property by which to sort an Array of Hashes
Examples
array_subtract (aliases: subtract_array)
Returns: Array<Object> - that is a difference between two arrays
Params
- array (Array<Object>) - an array of objects to be processed
- other_array (Array<Object>) - an array of objects to be processed
Examples
array_sum (aliases: sum_array)
Returns: Numeric - the summarised value of the array
Params
- array (Array<Numeric>) - array with values to be summarised
Examples
asset_url
Returns: String - URL to the physical file if existing, root asset URL otherwise
Params
- file_path (String) - path to the asset, relative to the assets directory
Examples
asset_path
Returns: String - relative path to the physical file decorated with updated param to invalidate CDN cache. Always prefer asset_url,
Params
- file_path (String) - path to the asset, relative to the assets directory
Examples
base64_decode
Returns: String - decoded string
Params
- base64_string (String) - Base64 encoded string
Examples
base64_encode
Returns: String - Returns the Base64-encoded version of bin. Line feeds are added to every 60 encoded characters. This method complies with RFC 2045.
Params
- bin (String) - string to be encoded
Examples
cast_json_string_to_hash
compute_hmac
Returns: String - Keyed-hash message authentication code (HMAC) that can be used to authenticate requests from third-party apps, e.g. Stripe webhooks requests
Params
- data (String) - message to be authenticated
- secret (String) - secret key
- algorithm (String) - defaults to SHA256. Supported algorithms are SHA, SHA1, SHA224, SHA256, SHA384, SHA512, MD4, MDC2, MD5, RIPEMD160, and DSS1. - default: 'sha256'
- digest (String) - defaults to hex. Supported digest values are hex, none, base64 - default: 'hex.'
Examples
date_add (aliases: add_to_date)
Returns: Date - modified Date
Params
- time (StringIntegerDateTime)
- number (Integer) - default: 1
- unit (String) - time unit - allowed options are: y, years, mo, months, w, weeks, d [default], days, h, hours, m, minutes, s, seconds - default: 'd'
Examples
decrypt
["Filter allowing to decrypt data encrypted with a specified algorithm. See encrypt filter for encryption."]
Returns: String - String - decrypted string using the algorithm of your choice. Initialization Vector (iv) is expected to be present in the encrypted payload at the beginning.
Params
- payload (String) - string payload to be decrypted - must be a Base64 encoded (RFC 4648) string
- algorithm (String) - algorithm you want to use for decryption
- key (String) - a secret key of the proper length (for example, AES256 requires a 256-bit key, which is 32 characters) to be used for decryption
- iv (optional) - - initialization vector, if not provided, we will automatically generate one
Examples
deep_clone
Returns: Object - returns a copy of the object parameter
Params
- object (Object) - object to be duplicated
Examples
digest
Returns: String - hexadecimal hash value obtained by applying the selected algorithm to the message
Params
- object (String) - a message that you want to obtain a cryptographic hash for
- algorithm (String) - the hash algorithm to use. Choose from: 'md5', 'sha1', 'sha256', 'sha384', 'sha512'. Default is sha1. - default: 'sha1'
- digest (String) - defaults to hex. Supported digest values are hex, none, base64 - default: 'hex.'
Examples
download_file
Returns: String - Body of the remote file
Params
- URL (String) - URL to a remote file
- max_size (Float) - max file size of the file, default 1 megabyte. It can't exceed 50 megabytes. - default: 1
Examples
encrypt
["Filter allowing to encrypt data with the specified algorithm. See decrypt filter for decryption"]
Returns: String - Base64 encoded (RFC 4648) encrypted string using the algorithm of your choice. Initialization Vector (iv) will be appended.
Params
- payload (String) - string payload to be encrypted
- algorithm (String) - algorithm you want to use for encryption
- key (String) - a secret key of the proper length (for example, AES256 requires a 256-bit key, which is 32 characters)
- iv (optional) - - initialization vector, if not provided we will automatically generate one - default: nil
Examples
escape_javascript
Returns: String - escaped text
Params
- text (String) - text to be escaped
Examples
expand_url_template
Returns: String - expanded URL
Params
- template (String) - URL template. Read more at https://tools.ietf.org/html/rfc6570
- params (Hash) - hash with data injected into the template
Examples
extract_url_params
Returns: Hash - hash with extracted params
Params
- URL (String) - URL with params to extract
- templates (StringArray) - URL templates array. Read more at https://tools.ietf.org/html/rfc6570
Examples
format_number
Returns: String - formatted number
Params
- number (Object) - string (numberlike), integer or float to format
- locale (String) - Sets the locale to be used for formatting (defaults to the current locale).
- precision (Integer) - Sets the precision of the number (defaults to 3).
- significant (String) - If true, precision will be the number of significant_digits. If false, the number of fractional digits (defaults to false).
- separator (String) - Sets the separator between the fractional and integer digits (defaults to ".").
- delimiter (String) - Sets the thousands delimiter (defaults to "").
- strip_insignificant_zeros (Boolean) - If true, removes insignificant zeros after the decimal separator (defaults to false).
Examples
fractional_to_amount
["Converts currency in fractional to the whole amount. For example, convert cents to USD."]
Returns: Integer - converted fractional amount
Params
- fractional (IntegerString) - fractional amount
- currency (String) - currency to be used - default: 'USD'
Examples
hash_add_key (aliases: add_hash_key, assign_to_hash_key)
Returns: Hash - hash with added key
Params
- hash (Hash)
- key (String)
- value (Object)
Examples
hash_delete_key (aliases: delete_hash_key, remove_hash_key)
Returns: Object - value which was assigned to a deleted key. Null is returned if the key did not exist in the first place.
Params
Examples
hash_diff
["Generates a list of additions (+), deletions (-) and changes (~) from given two objects."]
Returns: Array - array containing the difference between two hashes
Params
- hash1 (Hash)
- hash2 (Hash)
Examples
hash_dig (aliases: dig)
Returns: Object - Extracted nested value specified by the sequence of keys by calling dig at each step, returning null if any intermediate step is null.
Params
- hash (Hash)
- keys (Array) - comma-separated sequence of string keys to dig down the hash
Examples
hash_fetch (aliases: fetch)
Returns: Object
Params
- hash (Hash) - input hash to be traversed
- key (String) - key to be fetched from hash branch
Examples
hash_merge
Returns: Hash - new hash containing the contents of hash1 and the contents of hash2. On duplicated keys, we keep the value from hash2.
Params
- hash1 (Hash)
- hash2 (Hash)
Examples
hash_sort
Returns: Hash - Sorted hash
Params
- input (Hash) - Hash to be sorted
Examples
hcaptcha
Returns: Boolean - whether the parameters are valid hcaptcha verification parameters
Params
- params (Hash) - params sent to the server
Examples
html_safe
Returns: String - a string that can be rendered with all HTML tags. By default, all variables are escaped.
Params
- text (String)
- options (Hash) - set raw_text to true to stop it from unescaping HTML entities - default: {}
Examples
humanize
Returns: String - a human-readable string derived from the input; capitalizes the first word, turns underscores into spaces and strips a trailing '_id' if present. Used for creating a formatted output (e.g. by replacing underscores with spaces, capitalizing the first word, etc.).
Params
- key (String) - input string to be transformed
Examples
is_date_before (aliases: date_before)
Returns: Boolean - returns true if the first time is lower than the second.
Params
- first_time (StringIntegerDateTime) - time to compare to the second parameter
- second_time (StringIntegerDateTime) - time against which the first parameter is compared to
Examples
is_date_in_past
Returns: Boolean - true if time passed is in the past, false otherwise
Params
- time (StringIntegerDateTime) - time object, can also be a string
- now (StringIntegerDateTime) - sets the time from which operation should be performed
Examples
is_email_valid
Returns: Boolean - whether or not the argument is a valid email
Params
- text (String) - String containing potentially valid email
Examples
is_json_valid
Returns: Boolean - whether or not the argument is a valid JSON
Params
- text (String) - String containing potentially valid JSON
Examples
is_parsable_date
Returns: Boolean - whether the parameter can be parsed as a date
Params
- object (Object) - an object that can be a date
Examples
is_token_valid
["Temporary token is valid for the desired number of hours (by default 48), which you can use to authorize the user in third party application. To do it, include it in a header with the name UserTemporaryToken. Token will be invalidated on password change."]
Returns: Boolean - returns true if the token has not expired and was generated for the given user, false otherwise.
Params
- token (String) - encrypted token generated via the temporary_token GraphQL property
- user_id (Integer) - id of the user who generated the token
Examples
json (aliases: to_json)
Returns: String - JSON formatted string containing a representation of the object.
Params
- object (Object) - object you want a JSON representation of
Examples
jwe_encode (aliases: jwe_encode_rc)
Returns: String
Params
- json (String) - JSON body string that will be encrypted
- key (String) - Public key
- alg (required) - - Key Management Algorithm used to encrypt or determine the value of the Content Encryption Key. Valid options: Single Asymmetric Public/Private Key Pair RSA1_5 RSA-OAEP RSA-OAEP-256 Two Asymmetric Public/Private Key Pairs with Key Agreement ECDH-ES ECDH-ES+A128KW ECDH-ES+A192KW ECDH-ES+A256KW Symmetric Password-Based Key Derivation PBES2-HS256+A128KW PBES2-HS384+A192KW PBES2-HS512+A256KW Symmetric Key Wrap A128GCMKW A192GCMKW A256GCMKW A128KW A192KW A256KW Symmetric Direct Key (known to both sides) dir
- enc (required) - - Encryption Algorithm used to perform authenticated encryption on the plain text using the Content Encryption Key. Valid options: A128CBC-HS256 A192CBC-HS384 A256CBC-HS512 A128GCM A192GCM A256GCM
jwt_decode
Returns: Hash - the result of decoding the JWT token
Params
- encoded_token (String) - encoded JWT token you want to decode
- algorithm (String) - the algorithm that was used to encode the token
- secret (String) - either a shared secret or a PUBLIC key for RSA - default:.''
- verify_signature (Boolean) - default true, for testing and debugging can remove verifying the signature - default: true
- jwks (Hash) - JWK is a structure representing a cryptographic key. Currently only supports RSA public keys. Valid options: none - unsigned token HS256 - SHA-256 hash algorithm HS384 - SHA-384 hash algorithm HS512 - SHA-512 hash algorithm RS256 - RSA using SHA-256 hash algorithm RS384 - RSA using SHA-384 hash algorithm RS512 - RSA using SHA-512 hash algorithm - default: nil
Examples
jwt_encode
Returns: String - JWT token encrypted using the algorithm of your choice
Params
- payload (Hash) - payload or message you want to encrypt
- algorithm (String) - algorithm you want to use for encryption
- secret (String) - either a shared secret or a private key for RSA - default: nil
- header_fields (Hash) - optional hash of custom headers to be added to default { "typ": "JWT", "alg": "[algorithm]" } - default: {}
Examples
localize (aliases: l)
Returns: String, nil - formatted representation of the passed parsable time
Params
- time (StringIntegerDateTime) - parsable time object to be formatted
- format (String) - the format to be used for formatting the time; default is 'long'; other values can be used: they are taken from translations, keys are of the form 'time.formats.#!{format_name}' - default: 'long.'
- zone (String) - the time zone to be used for time - default: nil
- now (StringIntegerDateTime) - sets the time from which operation should be performed
Examples
map
Returns: Array - array which includes all values for a given key
Params
- object (Array<Hash>) - an array of Hash to be processed. Nulls are skipped.
- key (String) - the name of the hash key for which all values should be returned in an array of objects
Examples
markdown (aliases: markdownify)
Returns: String - processed text with markdown syntax changed to sanitized HTML. We allow only safe tags and attributes by default. We also automatically add `rel=nofollow` to links. Default configuration is: { "elements": ["a","abbr","b","blockquote","br","cite","code","dd","dfn","dl","dt","em","i","h1","h2","h3","h4","h5","h6","img","kbd","li","mark","ol","p","pre","q","s","samp","small","strike","strong","sub","sup","time","u","ul","var"], "attributes":{ "a": ["href"], "abbr":["title"], "blockquote":["cite"], "img":["align","alt","border","height","src","srcset","width"], "dfn":["title"], "q":["cite"], "time":["datetime","pubdate"] }, "add_attributes": { "a" : {"rel":"nofollow"} }, "protocols": { "a":{"href":["ftp","http","https","mailto","relative"]}, "blockquote": {"cite": ["http","https","relative"] }, "q": {"cite": ["http","https","relative"] }, "img": {"src": ["http","https","relative"] } } }
Params
- text (String) - text using markdown syntax
Examples
matches
Returns: Boolean - whether the given string matches the given regular expression; returns null if
Params
- text (String) - string to check against the regular expression
- regexp (String) - a string representing a regular expression pattern against which to match the first parameter
Examples
new_line_to_br (aliases: nl2br)
pad_left
Returns: String - returns string padded from left to the length of count with the symbol character
Params
- str (String) - string to pad
- count (Integer) - minimum length of the output string
- symbol (String) - string to pad with - default: ' '
Examples
parameterize
Returns: String - replaces special characters in a string so that it may be used as part of a 'pretty' URL; the default separator used is '-';
Params
- text (String) - input string to be 'parameterized.'
- separator (String) - string to be used as a separator in the output string; default is '-' - default: '-'
Examples
parse_csv (aliases: parse_csv_rc)
Returns: Array of Arrays - Array
Params
- input (String) - CSV
- :convert_to_hash (Boolean) - Returns [Array of Objects]
Examples
parse_json (aliases: to_hash)
Returns: Hash - Hash created based on JSON
Params
- object (Object) - String containing valid JSON
- options (Hash) - set to raw_text true to stop it from unescaping HTML entities - default: {}
Examples
parse_xml (aliases: xml_to_hash)
Returns: Hash - Hash created based on XML
Params
- XML (String) - String containing valid XML
- options (Hash) - attr_prefix: use '@' for element attributes, force_array: always try to use arrays for child elements - default: {}
Examples
pluralize
Returns: String - pluralized version of the input string
Params
- string (String) - string to be pluralized
- count (Number) - optional count number based on which string will be pluralized or singularized - default: 2
Examples
pricify
Returns: String - formatted price using global price formatting rules
Params
- amount (NumericString) - amount to be formatted
- currency (String) - currency to be used for formatting - default: 'USD.'
- options (Hash) - optional. Default no_cents_if_whole: true - default: {}
Examples
pricify_cents
["Adds currency symbol and proper commas. It is used to show prices to people."]
Returns: String - formatted price using the global price formatting rules
Params
- amount (NumericString) - the amount in cents to be formatted
- currency (String) - currency to be used for formatting - default: 'USD.'
Examples
querify
Returns: String - a query string
Params
- hash (Hash{Object => Object}) - hash to be "querified"
Examples
random_string
Returns: String - returns a random alphanumeric string of a given length
Params
- length (Int) - how many random characters should be included; default is 12 - default: 12
Examples
raw_escape_string
Returns: String - HTML-escaped input string; returns a string with its HTML tags visible in the browser
Params
- value (String) - input string to be HTML-escaped
Examples
regex_matches
Returns: Array<Array<String>> - matches for the expression in the string; each item in the array is an array containing all groups of matches; for example for the regex (.)(.) and the text 'abcdef', the result will look like: [["a", "b"], ["c", "d"], ["e", "f"]]
Params
- text (String)
- regexp (String) - regexp to use for matching
- options (String) - can contain 'ixm'; i - ignore case, x - extended, m # - multiline (e.g. 'ix', 'm', 'mi' etc.) - default: ''
Examples
replace_regex
Returns: String - string with regexp pattern replaced by the replacement text
Params
- text (String)
- regexp (String) - regexp to use for matching
- replacement (String) - replacement text, or hash; if hash, keys in the hash must be matched texts and values their replacements
- options (String) - can contain 'ixm'; i - ignore case, x - extended, m # - multiline (e.g. 'ix', 'm', 'mi' etc.) - default: ''
- global (Boolean) - whether all occurrences should be replaced or just the first - default: true
Examples
sanitize
Returns: String - Sanitizes HTML input. If you want to allow any HTML, use the html_safe filter. By default, we allow only safe HTML tags and attributes. We also automatically add `rel=nofollow` to links. Default configuration is: { "elements": ["a","abbr","b","blockquote","br","cite","code","dd","dfn","dl","dt","em","i","h1","h2","h3","h4","h5","h6","img","kbd","li","mark","ol","p","pre","q","s","samp","small","strike","strong","sub","sup","time","u","ul","var"], "attributes":{ "a": ["href"], "abbr":["title"], "blockquote":["cite"], "img":["align","alt","border","height","src","srcset","width"], "dfn":["title"], "q":["cite"], "time":["datetime","pubdate"] }, "add_attributes": { "a" : {"rel":"nofollow"} }, "protocols": { "a":{"href":["ftp","http","https","mailto","relative"]}, "blockquote": {"cite": ["http","https","relative"] }, "q": {"cite": ["http","https","relative"] }, "img": {"src": ["http","https","relative"] } } }
Params
- input (String) - potential malicious HTML, which you would like to sanitize
- options () - Options to configure which elements and attributes are allowed, example: { "elements": ["a", "b", "h1"], "attributes": { "a": ["href"] } } - default: SANITIZE_DEFAULT
- whitelist_tags (Array<String>) - deprecated; do not use - default: nil
Examples
sha1
Returns: String - SHA1 digest of the input object
Params
- object (String) - input object that you want to obtain the digest for
Examples
slugify
Returns: String - replaces special characters in a string so that it may be used as part of a 'pretty' URL;
Params
- text (String) - input string to be 'slugified.'
Examples
strftime
Returns: String - formatted representation of the time object; the formatted representation will be based on what the format parameter specifies
Params
- time (StringIntegerDateTimeDateTime) - parsable time object
- format (String) - a string representing the desired output format, e.g. '%Y-%m-%d' will result in '2020-12-21' Cheatsheet: https://devhints.io/strftime
- zone (String) - a string representing the time zone - default: nil
- now (StringIntegerDateTime) - sets the time from which operation should be performed - default: nil
Examples
strip_liquid
Returns: String - input parameter without liquid
Params
- text (String) - text from which to strip liquid
Examples
time_diff
Returns: Float - duration between start and finish in unit; default is ms (milliseconds)
Params
- start (StringIntegerDateTime)
- finish (StringIntegerDateTime)
- unit (String) - time unit - allowed options are d, days, h, hours, m, minutes, s, seconds, ms, milliseconds [default] - default: 'ms'
- precision (Integer) - defines rounding after comma; default is 3 - default: 3
Examples
titleize
Returns: String - capitalizes all the words and replaces some characters in the string to create a string in a title-case format
Params
- text (String) - string to be processed
Examples
to_csv
Returns: String - String containing CSV. If one array element has a separator, this element will automatically be wrapped in double quotes.
Params
- input (Array[Array]) - array you would like to convert to CSV
- :row_sep (String) - Specifies the row separator; used to delimit rows.
- :col_sep (String) - Specifies the column separator; used to delimit fields.
- :quote_char (String) - Specifies the quote character; used to quote fields.
- :write_headers (Boolean) - Specifies whether headers are to be written.
- :force_quotes (Boolean) - Specifies whether each output field is to be quoted.
- :quote_empty (Boolean) - Specifies whether each empty output field is to be quoted.
Examples
to_date
Returns: Date - a Date object obtained/parsed from the input object
Params
- time (StringIntegerDateTime) - parsable time object to be converted to date
- now (StringIntegerDateTime) - sets the time from which operation should be performed
Examples
to_mobile_number
Returns: String - returns mobile number in E.164 format; recommended for sending SMS notifications
Params
- number (String) - the base part of mobile number
- country (String) - country for which country code should be used. Can be anything - full name, iso2, iso3 - default: nil
Examples
to_positive_integer
Returns: Integer - a number that is higher than 0
Params
- param (Object) - value to be coerced to a positive integer
- default (Integer) - default value in case param is not a valid positive integer
Examples
to_time
Returns: DateTime - a time object created from parsing the string representation of time given as input
Params
- time (StringIntegerDateTime) - a string representation of time ('today', '3 days ago, 'in 10 minutes etc.) or an integer in UNIX time format or time
- zone (String) - time zone - default: nil
- format (String) - specific format to be used when parsing time - default: nil
- now (StringIntegerDateTime) - sets the time from which operation should be performed - default: nil
Examples
to_xml (aliases: to_xml_rc)
Returns: String - String containing XML
Params
- object (Hash) - a hash object that will be represented as XML
- options (Hash) - attr_prefix: use '@' for element attributes - default: {}
Examples
translate (aliases: t)
Returns: String - Translation value taken from translations YML file for the key given as parameter. The value is assumed to be HTML safe; please use `t_escape` if you provide an unsafe argument that can potentially include a malicious script.
Params
- key (String) - translation key
- options (Hash{String => String}) - values passed to translation string - default: {}
Examples
translate_escape (aliases: t_escape)
["Escapes unsafe arguments passed to the translation and then returns its value"]
Returns: String - translation value taken from translations YML file for the key given as parameter
Params
- key (String) - translation key
- options (Hash{String => String}) - values passed to translation string - default: {}
Examples
type_of
Returns: String - Type of the variable parameter
Params
- variable (Object) - Variable whose type you want to be returned
Examples
url_to_qrcode_svg
Returns: A qr code that contains a url code
Params
- url (String) - URL to be encoded as QR code
- width - Set the svg width
- height - Set the svg height
- viewbox (Boolean) - Replace the `svg.width` and `svg.height` attribute with `svg.viewBox` to allow CSS scaling , default false
- color (String) - Default is "000"
Examples
useragent
Returns: Hash - parsed browser user agent information
Params
- useragent_header (String) - browser user agent from the request header
Examples
uuid
Returns: String - Universally unique identifier v4
Params
- _dummy (String) - parameter will be ignored - default: nil
Examples
verify_access_key
Returns: Boolean - check if a key is valid
Params
- access_key (String) - can be obtained in the Partner Portal
Examples
video_params
Returns: Hash - metadata about the video
Params
- URL (String) - URL to a video on the internet
Examples
videoify
Returns: String - if the given URL is supported, an HTML formatted string containing a video player (inside an iframe) will play the video at the given URL; otherwise, an empty string is returned.
Params
- URL (String) - URL to a video on the internet - default: ''
Examples