class Monolith::BranchNameFormatter

Public Class Methods

new(name) click to toggle source
  # File lib/monolith/branch_name_formatter.rb
3 def initialize(name)
4   @name = name
5 end

Public Instance Methods

name() click to toggle source
   # File lib/monolith/branch_name_formatter.rb
 7 def name
 8   strip_selected_branch_prefix
 9   strip_whitespace_prefix
10   strip_remote_prefix
11   @name
12 end

Private Instance Methods

strip(pattern) click to toggle source
   # File lib/monolith/branch_name_formatter.rb
28 def strip(pattern)
29   @name.sub!(pattern, "")
30 end
strip_remote_prefix() click to toggle source
   # File lib/monolith/branch_name_formatter.rb
24 def strip_remote_prefix
25   strip("remotes/origin/")
26 end
strip_selected_branch_prefix() click to toggle source
   # File lib/monolith/branch_name_formatter.rb
16 def strip_selected_branch_prefix
17   strip("*")
18 end
strip_whitespace_prefix() click to toggle source
   # File lib/monolith/branch_name_formatter.rb
20 def strip_whitespace_prefix
21   strip(/\s+/)
22 end