Class: String

Inherits:
Object show all
Defined in:
lib/branch_cli/string.rb,
lib/branch_cli/swift_compatibility.rb

Instance Method Summary collapse

Instance Method Details

#BlueObject



30
31
32
# File 'lib/branch_cli/string.rb', line 30

def Blue
  "[blue]#{self}[/]"
end

#BoldObject



18
19
20
# File 'lib/branch_cli/string.rb', line 18

def Bold
  "[bold]#{self}[/]"
end

#clearQuotesObject



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

#fObject



22
23
24
# File 'lib/branch_cli/string.rb', line 22

def f
  self
end

#GreenObject



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

#RedObject



34
35
36
# File 'lib/branch_cli/string.rb', line 34

def Red
  "[red]#{self}[/]"
end

#sObject



14
15
16
# File 'lib/branch_cli/string.rb', line 14

def s
  self
end

#YellowObject



38
39
40
# File 'lib/branch_cli/string.rb', line 38

def Yellow
  "[yellow]#{self}[/]"
end