Class: String

Overview

Ruuuby modifications to existing Class<code>String</code>

Defined Under Namespace

Modules: ContextF24, Syntax

Instance Method Summary collapse

Methods included from Ruuuby::Feature::Includable::StringF26

#as_iso8601, #iso8601?, #to_iso8601

Methods included from Ruuuby::Feature::Includable::StringF21

#digit?, #to_num, #to_num?

Methods included from Ruuuby::Feature::Includable::StringF09

#∈?, #∉?, #∋?, #∌?

Methods included from Ruuuby::Feature::Includable::StringF08

#downcase?, #ensure_ending!, #ensure_start!, #remove_until, #remove_until_last, #upcase?, #♻️⟵

Methods included from Ruuuby::Attribute::Includable::Cardinality

included, #𝔠₁?, #𝔠₂?, #𝔠₃?, #𝔠₄?, #𝔠₅?, #𝔠₋

Methods included from Ruuuby::Attribute::Includable::SyntaxCache

included

Methods included from Ruuuby::Attribute::Includable::SubscriptIndexing

#₀, #₀?, #₁, #₁?, #₂, #₃

Instance Method Details

#as_utf8String

Returns self with modified encoding if not already UTF-8.

Returns:

  • (String)

    self with modified encoding if not already UTF-8



420
# File 'lib/ruuuby/class/str/str.rb', line 420

def as_utf8; self.force_encoding(::Encoding::UTF_8); end

#clean!Object



402
403
404
# File 'lib/ruuuby/class/str/str.rb', line 402

def clean!
  self.gsub!($/, '')
end

#palindrome?Boolean

Returns true, if this String has equal contents written forwards or backwards.

Returns:

  • (Boolean)

    true, if this String has equal contents written forwards or backwards



423
# File 'lib/ruuuby/class/str/str.rb', line 423

def palindrome?; self == self.; end

#η̂(normalizer) ⇒ String

TODO: not finalized design

Parameters:

Returns:



411
412
413
414
415
416
417
# File 'lib/ruuuby/class/str/str.rb', line 411

def η̂(normalizer)
  if normalizer == :iso8601
    self.as_iso8601
  else
    🛑 RuntimeError.new("c{String}-> m{η̂} got invalid arg(normalizer){#{normalizer.to_s}} w/ type{#{normalizer.}}")
  end
end