Ruby

Ruby cards let you code in Ruby directly in Wagn.
The Ruby itself is run in a protected sandbox, but we recommend settings permissions so that only Administrators can create and edit them.
By default Ruby cards are not turned on. To do so, you will need to add the following to config/wagn.rb:
System.enable_ruby_cards = true
One of the most powerful uses of Ruby cards is to do calculations based on other cards, and you can use inclusions to do this. For example if you had Number cards named "a" and "b", then a Ruby card with:
aaaaa
+
...would calculate the sum of the current numbers in a and b. The "naked" views gives you just the naked content, avoiding all the extra HTML in default "content" view.
contextual names combined with formatting make it possible for you to create a single Ruby card that draws on different cards depending on where it appears. For example, if you had a Wagn organizing information about track & field teams, you could have a "Teams" card type where you wanted to sum the best 100 meter dash times of the four members of the team. You would only need one Ruby card to do the summing. It could be called sum+*right+*content, and then the form for Team cards would include "+sum", which would do the calculation whenever you looked at any team's card. This Ruby card would include an array of the best times with something like . The array views renders the cards in Ruby's array notation, e.g. ["10.9", "11.1", "11.4", "10.8"], as well as being naked of HTML. To make this work as expected, "best times+*right+*content" would be a Search returning the cards with the best time for every member of the given team.
