Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add in stub docs for date. Add mention of StringFormatter to core docs

  • Loading branch information...
commit b04f8cfe78b35d69e30216e8306e8881f2e0f685 1 parent 8a07787
Andrew Whitworth authored
Showing with 61 additions and 0 deletions.
  1. +22 −0 libraries/core.md
  2. +39 −0 libraries/date.md
22 libraries/core.md
View
@@ -157,6 +157,18 @@ must specify it:
using Rosella.load_bytecode_file;
var pf = load_bytecode_file("foo/bar.pbc", "load");
+### String Formatting
+
+Creating a string representation of an object, especially one suitable for
+human-readable display, is tricky. This is especially true since almost all
+data objects could be converted into a huge array of different string
+representations depending on different formatting, display aesthetic needs.
+Rosella provides utilities to format data based on custom formatting rules.
+
+The default Rosella string formatter uses `sprintf` internally and so admits
+the same format strings as taken by that opcode. Other Rosella libraries may
+define and provide additional formatters for other purposes.
+
## Namespaces
### Rosella
@@ -256,6 +268,16 @@ ObjectFactory is the parent type of all other factory objects in Rosella.
The basic ObjectFactory has limited utility, but it provides a common
interface for other, more advanced, factory types.
+### Rosella.StringFormatter
+
+The StringFormatter class is used to stringify objects according to a given
+pattern. The default StringFormatter uses Parrot's `sprintf` internally.
+
+Other Rosella libraries and types may define other StringFormatter subclasses
+to use. Where a Rosella type uses a custom formatter, it will define
+`.get_string_converter()` and a `.format_string(fmt)` methods to use with it.
+Only data objects might define these methods and customer formatters.
+
### Rosella.Version
The `Rosella.Version` class is used as the return object from the
39 libraries/date.md
View
@@ -0,0 +1,39 @@
+---
+layout: rosella
+title: Rosella Date
+---
+
+## Overview
+
+The Rosella Date library provides an immutable Date type for representing
+dates and times. It provides a handful of utilities for working with Date
+objects as well.
+
+## Concepts
+
+## Namespaces
+
+### Rosella.Date
+
+## Classes
+
+### Rosella.Date
+
+### Rosella.Date.DateFormatter
+
+### Rosella.Date.SpecialDate
+
+### Rosella.Date.SpecialDate.Minimum
+
+### Rosella.Date.SpecialDate.Maximum
+
+## Examples
+
+### Winxed
+
+ var d = new Rosella.Date.now();
+ say(d.format_string("It is yyyy-MM-dd at exactly hh:mm:ss"));
+
+### NQP-rx
+
+## Users
Please sign in to comment.
Something went wrong with that request. Please try again.