Module: Ruuuby::Feature::Includable::StringF08

Included in:
String
Defined in:
lib/ruuuby/class/str/str.rb

Overview

defines the operations needed to support Feature(f08) that are applied to Class(String)

Instance Method Summary collapse

Instance Method Details

#downcase?Boolean

Returns true, if this String is of length 1 and the character is lowercase.

Returns:

  • (Boolean)

    true, if this String is of length 1 and the character is lowercase



30
31
32
33
34
35
36
37
38
39
# File 'lib/ruuuby/class/str/str.rb', line 30

def downcase?
  case(self.

#ensure_ending!(ending) ⇒ String

Returns the original string with ending-string added if missing prior.

Parameters:

  • ending (String)

    the text that this string should end with

Returns:

  • (String)

    the original string with ending-string added if missing prior

Raises:

  • (ArgumentError)


117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/ruuuby/class/str/str.rb', line 117

def ensure_ending!(ending)
  

#ensure_start!(start) ⇒ String

Returns the original string with the starting text added if at least partially missing prior.

Parameters:

  • start (String)

    the text that this string start with

Returns:

  • (String)

    the original string with the starting text added if at least partially missing prior

Raises:

  • (ArgumentError)


98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/ruuuby/class/str/str.rb', line 98

def ensure_start!(start)
  

#remove_until(stop_at, num_matches = 1) ⇒ String

Returns self, with all content (leading up to argterminating_pattern) removed.

Parameters:

  • stop_at (String)
  • num_matches (Integer, Float) (defaults to: 1)

    (default: 1), use value-1 or∞ to have no limit on matches

Returns:

  • (String)

    self, with all content (leading up to argterminating_pattern) removed

Raises:

  • (ArgumentError, RuntimeError)

    thrown when arg(terminating_pattern) was not found in self



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ruuuby/class/str/str.rb', line 47

def remove_until(stop_at, num_matches=1)
  

#remove_until_last(stop_at) ⇒ String

Returns self, with all content (leading up to argterminating_pattern) removed.

Parameters:

Returns:

  • (String)

    self, with all content (leading up to argterminating_pattern) removed

Raises:

  • (ArgumentError, RuntimeError)

    thrown when arg(terminating_pattern) was not found in self



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

def remove_until_last(stop_at) ; self.remove_until(stop_at, -1) ; end

#upcase?Boolean

Returns true, if this String is of length 1 and the character is uppercase.

Returns:

  • (Boolean)

    true, if this String is of length 1 and the character is uppercase



18
19
20
21
22
23
24
25
26
27
# File 'lib/ruuuby/class/str/str.rb', line 18

def upcase?
  case(self.

#♻️⟵(stop_at, num_matches = 1) ⇒ String

Returns self, with all content (leading up to argstop_at) removed, searched from reversed order and then returned back in original order.

Parameters:

  • stop_at (String)
  • num_matches (Integer, Float) (defaults to: 1)

    (default: 1), use value-1 or∞ to have no limit on matches

Returns:

  • (String)

    self, with all content (leading up to argstop_at) removed, searched from reversed order and then returned back in original order

Raises:

  • (ArgumentError, RuntimeError)


81
82
83
84
# File 'lib/ruuuby/class/str/str.rb', line 81

def