Skip to main content
Kinetic Community

KURL Functions

IDF guide rendered from cache
The first part of this article provides some information about the Ruby programming language and terminology used throughout the KURL documentation.  The second part of this article is a table of contents that lists the functions provided by the KURL DSL with a link to each one.

Ruby

KURL is a domain-specific language written in the Ruby programming language.  Ruby was chosen because it has a simple syntax but yet remains very powerful.

To work with KURL, a very minimal understanding of Ruby is required.  Below are the elements of Ruby that will be found within KURL code.

Strings

A String is a sequence of characters.  Strings in Ruby can be delimited with the " (quote) and ' (apostrophe) characters.  They can also be delimited with other characters by using the % character before the other character, $ for example.

"This is a String"
%|This is also a String|

Symbols

A Symbol can be thought of as a String.  They are used in KURL purely out of convention.  Below are some examples.

:this_is_a_symbol
:help_text

Function Calls

A function call in ruby starts with the name of the function and a group of comma-separated arguments.  The arguments a function takes is defined by the function.  Note that the documentation for each KURL function describes the parameters it takes.  Below are some examples.

function "argument1", "argument2"
divide 10, 2

Code Blocks

A code block is a piece of code that is passed to a function call as an argument.  The code block will always be defined after the rest of the arguments and is delimited with the do-end keywords or braces {-}.  Below are some examples.

function "argument" do
  # some ruby code here
end
function "argument" {
  # some more ruby code here
}

Terminology

The KURL documentation introduces its own terms to help describe the KURL functions.  Below is an example of the format that a KURL function call takes and definitions of the terms that are used throughout the documentation.

function "argument", "argument2",
  :flag1,
  :flag2,
  :option1 => "value",
  :option2 => "value2" do
  # Ruby code to be evaluated goes here.
end

Function

The function name will indicate the type of object that will be created by calling that function.  For example, the question function will create a question on the service item.  The function name is in bold black text above.

Arguments

The comma-separated String values that immediately follow the function name.  Some functions take more string arguments than others.  The arguments are shown in red text above.

Flags

The Symbol values that follow the String arguments.  These are generally used to enable/disable boolean type options.  For example the :required flag will set a question to be required upon submission.  The flags are shown in blue text above.

Options

The Symbol values that take String values using the following operator: =>.  These are generally used for options that take String values.  For example the :default option will set a default answer for a question.  The options are shown in green text above.

Code Block

Every KURL function also has its own list of other KURL functions that are available for use within the code black passed to it. For example, within the code block passed to the page function we can use the section, text, question, style, event, and branching functions.  Within the code block passed to the section function we can use just the style and event functions.  The code block is shown in purple text above.

Functions