class
Sheen::List
- Sheen::List
- Reference
- Object
Overview
A list of items rendered with a leading enumerator indicator.
List is a wrapper over Tree, and all styling methods delegate to the wrapped Tree. Items become tree children (lol) and a nested List nests as a subtree.
Defined in:
sheen/list.crConstant Summary
-
ALPHA_LEN =
26 -
ROMAN_SYMBOLS =
["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] of ::String -
ROMAN_VALUES =
[1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
Constructors
-
.new(*items)
Build a list of items.
Class Method Summary
-
.alpha(_items : Tree::Children, index : Int32) : String
The upcased alphabet enumerator.
-
.arabic(_items : Tree::Children, index : Int32) : String
The arabic-numeral enumerator.
-
.asterisk(_items : Tree::Children, _index : Int32) : String
The asterisk enumerator.
-
.bullet(_items : Tree::Children, _index : Int32) : String
The bullet enumerator.
-
.dash(_items : Tree::Children, _index : Int32) : String
The dash enumerator.
-
.roman(_items : Tree::Children, index : Int32) : String
The roman numeral enumerator.
-
.space_indenter(_items : Tree::Children, _index : Int32) : String
The space indenter.
Instance Method Summary
-
#enumerator(enumr : Tree::Enumerator) : List
Sets the enumerator generating each item's prefix.
-
#enumerator(&block : Tree::Children, Int32 -> String) : List
Sets the enumerator from a block.
-
#enumerator(kind : Enumerators) : List
Convenience method to set one of the builtin enumerator styles by kind.
-
#enumerator_style(style : Style) : List
Sets one static style for every enumerator prefix.
-
#enumerator_style(&block : Tree::Children, Int32 -> Style) : List
Sets the enumerator style block, invoked per item.
-
#hidden? : Bool
Whether the list is hidden or not.
-
#hide(hidden : Bool = true) : List
Sets whether the list is hidden from rendering.
-
#indenter(ind : Indenter) : List
Sets the indenter used for nested items.
-
#indenter(&block : Tree::Children, Int32 -> String) : List
Sets the indenter from a block.
-
#item(value : List) : List
Appends a nested value list, which nests as a subtree
-
#item(value) : List
Appends value to an item.
-
#item_style(style : Style) : List
Sets one static style for every item's value
-
#item_style(&block : Tree::Children, Int32 -> Style) : List
Sets the item style block, invoked per item.
-
#items(*values) : List
Appends each of the values as an item
-
#render : String
Renders the list to a string.
-
#to_s(io : IO) : Nil
Renders the list to io.
-
#value : String
The list's underlying root value.
Constructor Detail
Build a list of items. Uses the bullet enumerator and a single space indent as defaults.
Class Method Detail
The space indenter. This is the list default.
Instance Method Detail
Sets the enumerator generating each item's prefix.
Returns self.
Sets the enumerator from a block.
Returns self.
Convenience method to set one of the builtin enumerator styles by kind. eg #enumerator(:roman)
Returns self.
Sets one static style for every enumerator prefix.
Returns self.
Sets the enumerator style block, invoked per item.
Returns self.
Sets the indenter used for nested items.
Returns self.
Sets the indenter from a block.
Returns self.
Appends a nested value list, which nests as a subtree
Returns self.
Sets one static style for every item's value
Returns self
Sets the item style block, invoked per item.
Returns self.