Module: PryRailsDiffRoutes::Util

Included in:
ModifiedRoutesFormatter, RouteWrapper
Defined in:
lib/pry_rails_diff_routes/util.rb

Class Method Summary collapse

Class Method Details

.arrow_key(key) ⇒ Object



13
14
15
# File 'lib/pry_rails_diff_routes/util.rb', line 13

def arrow_key(key)
  key.ljust(12, ' ') + '->'
end

.bold(text) ⇒ Object



29
30
31
# File 'lib/pry_rails_diff_routes/util.rb', line 29

def bold(text)
  "\e[1m#{text}\e[0m"
end

.bold_green(text) ⇒ Object



41
42
43
# File 'lib/pry_rails_diff_routes/util.rb', line 41

def bold_green(text)
  "\e[1;32m#{text}\e[0m"
end

.bold_red(text) ⇒ Object



33
34
35
# File 'lib/pry_rails_diff_routes/util.rb', line 33

def bold_red(text)
  "\e[1;31m#{text}\e[0m"
end

.bold_yellow(text) ⇒ Object



37
38
39
# File 'lib/pry_rails_diff_routes/util.rb', line 37

def bold_yellow(text)
  "\e[1;33m#{text}\e[0m"
end

.dim_format(text) ⇒ Object



17
18
19
# File 'lib/pry_rails_diff_routes/util.rb', line 17

def dim_format(text)
  text.sub(/(\(.:format\))$/, "\e[2m\\1\e[0m")
end

.highlight_green(text) ⇒ Object



25
26
27
# File 'lib/pry_rails_diff_routes/util.rb', line 25

def highlight_green(text)
  "\e[1;42m#{text}\e[0m"
end

.highlight_red(text) ⇒ Object



21
22
23
# File 'lib/pry_rails_diff_routes/util.rb', line 21

def highlight_red(text)
  "\e[1;41m#{text}\e[0m"
end

.pad_lines(text = "", pad_length = 0) ⇒ Object



9
10
11
# File 'lib/pry_rails_diff_routes/util.rb', line 9

def pad_lines(text="", pad_length=0)
  text.gsub(/^(.*)$/, ' ' * 2 * pad_length + "\\1")
end