struct Novika::Quote::StringQuote
- Novika::Quote::StringQuote
- Struct
- Value
- Object
Overview
Quote type for multiple (two or more), or no graphemes.
Included Modules
Defined in:
novika/forms/quote.crConstructors
-
.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 Summary
Instance Method Summary
-
#==(other : Quote) : Bool
Returns whether this quote variant consists of the same graphemes as other.
-
#ascii_only? : Bool
Returns whether this string quote consists of ASCII characters only.
-
#at(b : Int32, e : Int32) : Quote
Returns a subquote from b to e.
-
#at?(index : Int32) : GraphemeQuote | Nil
Returns the grapheme at index as
Quote
, or nil. -
#cached_count? : Int32 | Nil
Returns the cached perceived character count in this string quote, or nil.
-
#count : Int32
Returns the amount of graphemes in this quote variant.
- #each_occurrence_of(pattern : StringQuote, &)
- #each_occurrence_of(pattern : GraphemeQuote, &)
-
#empty? : Bool
Returns whether this quote is empty.
- #fit(total : Int, ellipsis : Quote) : Quote
- #pad(total : Int, padder : StringQuote, side : PadSide) : Quote
- #pad(total : Int, padder : GraphemeQuote, side : PadSide) : Quote
-
#replace_all(pattern : Quote, repl : Quote) : Quote
Replaces instances of pattern with repl.
- #stitch(other : StringQuote)
-
#string : String
Returns the underlying string.
- #to_s(io)
Instance methods inherited from module Novika::Quote
==(other : Quote) : Bool
==,
at(b : Int32, e : Int32) : Quoteat(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
Creates a string quote from the given string.
Class Method Detail
Instance Method Detail
Returns whether this quote variant consists of the same graphemes as other.
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.
Returns the grapheme at index as Quote
, or nil.
Returns the cached perceived character count in this string quote, or nil.
Returns the amount of graphemes in this quote variant.
Returns whether this quote is empty.
Replaces instances of pattern with repl. Returns the resulting quote.