Class: String
- Defined in:
- lib/branch_cli/string.rb,
lib/branch_cli/swift_compatibility.rb
Instance Method Summary collapse
- #Blue ⇒ Object
- #Bold ⇒ Object
- #clearQuotes ⇒ Object
- #components(separatedBy: ",") ⇒ Object
- #contains(*args) ⇒ Object
- #f ⇒ Object
- #Green ⇒ Object
- #hasPrefix(str) ⇒ Object
- #matches(forRegex: nil) ⇒ Object
- #Red ⇒ Object
- #s ⇒ Object
- #Yellow ⇒ Object
Instance Method Details
#Blue ⇒ Object
30 31 32 |
# File 'lib/branch_cli/string.rb', line 30 def Blue "[blue]#{self}[/]" end |
#Bold ⇒ Object
18 19 20 |
# File 'lib/branch_cli/string.rb', line 18 def Bold "[bold]#{self}[/]" end |
#clearQuotes ⇒ Object
10 11 12 |
# File 'lib/branch_cli/string.rb', line 10 def clearQuotes gsub("\"", with: "") end |
#components(separatedBy: ",") ⇒ Object
67 68 69 |
# File 'lib/branch_cli/swift_compatibility.rb', line 67 def components(separatedBy: ",") split(separatedBy) end |
#contains(*args) ⇒ Object
59 60 61 |
# File 'lib/branch_cli/swift_compatibility.rb', line 59 def contains(*args) include?(*args) end |
#f ⇒ Object
22 23 24 |
# File 'lib/branch_cli/string.rb', line 22 def f self end |
#Green ⇒ Object
26 27 28 |
# File 'lib/branch_cli/string.rb', line 26 def Green "[green]#{self}[/]" end |
#hasPrefix(str) ⇒ Object
63 64 65 |
# File 'lib/branch_cli/swift_compatibility.rb', line 63 def hasPrefix(str) start_with?(str) end |
#matches(forRegex: nil) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/branch_cli/string.rb', line 2 def matches(forRegex: nil) lines = split("\n") lines.map do |l| match = l.match(forRegex) match && match.captures end.flatten.compact end |
#Red ⇒ Object
34 35 36 |
# File 'lib/branch_cli/string.rb', line 34 def Red "[red]#{self}[/]" end |
#s ⇒ Object
14 15 16 |
# File 'lib/branch_cli/string.rb', line 14 def s self end |
#Yellow ⇒ Object
38 39 40 |
# File 'lib/branch_cli/string.rb', line 38 def Yellow "[yellow]#{self}[/]" end |