struct Novika::Quote::StringQuote

Overview

Quote type for multiple (two or more), or no graphemes.

Included Modules

Defined in:

novika/forms/quote.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Novika::Quote

==(other : Quote) : Bool ==, at(b : Int32, e : Int32) : Quote
at(index : Int32) : GraphemeQuote
at
, at?(index : Int32) : GraphemeQuote | Nil at?, cached_count? : Int32 | Nil cached_count?, count : Int32 count, desc(io : IO) desc, each_occurrence_of(pattern : Form, &) each_occurrence_of, effect(io) effect, empty? : Bool empty?, first_byte? : UInt8 | Nil first_byte?, fit(total : Int, ellipsis : _) : Quote fit, ord? : Int32 | Nil ord?, pad(total : Int, padder : _, side : PadSide) : Quote pad, replace_all(pattern : Quote, repl : Quote) : Quote replace_all, slice_at(slicept : Int32) : Tuple(Quote, Quote) slice_at, slice_at?(slicept : Int32) : Tuple(Quote, Quote) | Nil slice_at?, stitch(other : Quote) : Quote stitch, string : String string, to_byteslice to_byteslice, to_quote : Quote to_quote

Constructor methods inherited from module Novika::Quote

new(string : String, count = string.grapheme_size, ascii = string.ascii_only?)
new(grapheme : String::Grapheme)
new(char : Char)
new

Class methods inherited from module Novika::Quote

typedesc typedesc

Instance methods inherited from module Novika::Form

a(type : T.class) : T forall T a, desc(io : IO)
desc : String
desc
, die(details : String) die, effect(io)
effect
effect
, on_open(engine : Engine) : self on_open, on_parent_open(engine : Engine) : self on_parent_open, onto(block : Block) : self onto, sel(a, b) sel, to_quote : Quote to_quote

Instance methods inherited from module Novika::Schedulable

schedule(engine : Engine, stack : Block) schedule, schedule!(engine : Engine, stack : Block) schedule!

Constructor Detail

def self.new(string : String, count cached_count : Int32 | Nil = nil, ascii_only : Bool = string.ascii_only?) #

Creates a string quote from the given string.


Class Method Detail

def self.typedesc #

Instance Method Detail

def ==(other : Quote) : Bool #
Description copied from module Novika::Quote

Returns whether this quote variant consists of the same graphemes as other.


def ascii_only? : Bool #

Returns whether this string quote consists of ASCII characters only.


def at(b : Int32, e : Int32) : Quote #
Description copied from module Novika::Quote

Returns a subquote from b to e. Clamps b and e to bounds of this quote. Returns an empty quote if this quote is empty without regarding b and e.

Both ends are inclusive.


def at?(index : Int32) : GraphemeQuote | Nil #
Description copied from module Novika::Quote

Returns the grapheme at index as Quote, or nil.


def cached_count? : Int32 | Nil #

Returns the cached perceived character count in this string quote, or nil.


def count : Int32 #
Description copied from module Novika::Quote

Returns the amount of graphemes in this quote variant.


def each_occurrence_of(pattern : StringQuote, &) #

def each_occurrence_of(pattern : GraphemeQuote, &) #

def empty? : Bool #
Description copied from module Novika::Quote

Returns whether this quote is empty.


def fit(total : Int, ellipsis : Quote) : Quote #

def pad(total : Int, padder : StringQuote, side : PadSide) : Quote #

def pad(total : Int, padder : GraphemeQuote, side : PadSide) : Quote #

def replace_all(pattern : Quote, repl : Quote) : Quote #
Description copied from module Novika::Quote

Replaces instances of pattern with repl. Returns the resulting quote.


def stitch(other : StringQuote) #

def string : String #

Returns the underlying string.


def to_s(io) #