struct

Poor::Markup

Inherits Indexable::Mutable < Indexable < Enumerable < Iterable < Struct < Value < Object

Abstract representation of a marked-up text.

Constructors

Instance methods

children
Source
each

Calls the given block once for each element in self, passing that element as a parameter.

a = ["a", "b", "c"]
a.each { |x| print x, " -- " }

produces:

a -- b -- c --
Source
each

Returns an Iterator for the elements of self.

a = ["a", "b", "c"]
iter = a.each
iter.next # => "a"
iter.next # => "b"

The returned iterator keeps a reference to self: if the array changes, the returned values of the iterator change as well.

Source
each_end
Source
each_end
Source
each_recursive
Source
each_recursive
Source
each_start
Source
each_start
Source
each_start_end
Source
each_start_end
Source
each_token
Source
initialize
Source
inspect(io : IO)

Appends this struct's name and instance variables names and values to the given IO.

struct Point
  def initialize(@x : Int32, @y : Int32)
  end
end

p1 = Point.new 1, 2
p1.to_s    # "Point(@x=1, @y=2)"
p1.inspect # "Point(@x=1, @y=2)"
Source
map_recursive!
Source
pretty_print(pp : PrettyPrint)

Pretty prints self into the given printer.

By default appends a text that is the result of invoking #inspect on self. Subclasses should override for custom pretty printing.

Source
size

Returns the number of elements in this container.

Source
text(io : IO)
Source
text
Source
to_ansi(io : IO)

Converts the rich text into text with ANSI escape codes for display in terminal.

Source
to_ansi
Source
to_html(io : IO)
Source
to_html
Source
unsafe_fetch(index : Int)

Returns the element at the given index, without doing any bounds check.

Indexable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they access elements with #[](index) and #[]?(index).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.

Source
unsafe_put(index : Int, value : Markup)

Sets the element at the given index to value, without doing any bounds check.

Indexable::Mutable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they modify elements with #[]=(index, value).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.

Source