Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/git/status_all/extensions.rb

Instance Method Summary collapse

Instance Method Details

#_term_widthObject



20
21
22
# File 'lib/git/status_all/extensions.rb', line 20

def _term_width
	@term_width ||= `tput cols`.to_i
end

#append(s) ⇒ Object



4
5
6
# File 'lib/git/status_all/extensions.rb', line 4

def append(s)
	self + s
end

#pad_to_col(n) ⇒ Object



8
9
10
11
12
# File 'lib/git/status_all/extensions.rb', line 8

def pad_to_col(n)
	pad_amount = n - self.uncolorize.length
	return " " + s if pad_amount < 0
	return self + (" " * pad_amount)
end

#right_align(s) ⇒ Object



14
15
16
17
18
# File 'lib/git/status_all/extensions.rb', line 14

def right_align(s)
	pad_amount = self._term_width - self.uncolorize.length - s.uncolorize.length
	return " " + s if pad_amount < 0
	return self + (" " * pad_amount) + s
end