module Marten::Template::Tag::CanSplitSmartly

Overview

Allows to split expressions by respecting literal values.

This module provides the ability to split string contents by respecting the presence of single-quoted or double-quoted expressions (which can themselves contain spaces):

Tag.split_smartly("This is a 'simple test'")   # => ["This", "is", "a", "'simple test'"]
Tag.split_smartly("This is a \"simple test\"") # => ["This", "is", "a", "\"simple test/""]

Direct including types

Defined in:

marten/template/tag/concerns/can_split_smartly.cr

Instance Method Summary

Instance Method Detail

def split_smartly(expression : String) : Array(String) #

Split a string expression and returns an array of strings.


[View source]