Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/string.rb

Overview

Add convenience methods to grab information from git refs

Instance Method Summary collapse

Instance Method Details

#to_local_branchObject

Grabs branch name from git remote refs.



4
5
6
# File 'lib/core_ext/string.rb', line 4

def to_local_branch
  self[%r{refs/remotes/origin/(.*)}, 1]
end

#to_tagObject

Grabs tag name from git tag refs.



9
10
11
# File 'lib/core_ext/string.rb', line 9

def to_tag
  self[%r{refs/tags/(.*)}, 1]
end