Class: R10K::Source::Git::BranchName Private
- Inherits:
-
Object
- Object
- R10K::Source::Git::BranchName
- Defined in:
- lib/r10k/source/git.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- INVALID_CHARACTERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%r[\W]
Instance Attribute Summary collapse
- #name ⇒ Object readonly private
Instance Method Summary collapse
- #correct? ⇒ Boolean private
- #dirname ⇒ Object private
-
#initialize(name, opts) ⇒ BranchName
constructor
private
A new instance of BranchName.
- #valid? ⇒ Boolean private
- #validate? ⇒ Boolean private
Constructor Details
#initialize(name, opts) ⇒ BranchName
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BranchName.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/r10k/source/git.rb', line 145 def initialize(name, opts) @name = name @opts = opts @prefix = opts[:prefix] @sourcename = opts[:sourcename] @invalid = opts[:invalid] case @invalid when 'correct_and_warn' @validate = true @correct = true when 'correct' @validate = false @correct = true when 'error' @validate = true @correct = false when NilClass @validate = opts[:validate] @correct = opts[:correct] end end |
Instance Attribute Details
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
141 142 143 |
# File 'lib/r10k/source/git.rb', line 141 def name @name end |
Instance Method Details
#correct? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
169 |
# File 'lib/r10k/source/git.rb', line 169 def correct?; @correct end |
#dirname ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/r10k/source/git.rb', line 180 def dirname dir = @name.dup if @prefix dir = "#{@sourcename}_#{dir}" end if @correct dir.gsub!(INVALID_CHARACTERS, '_') end dir end |
#valid? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
172 173 174 175 176 177 178 |
# File 'lib/r10k/source/git.rb', line 172 def valid? if @validate ! @name.match(INVALID_CHARACTERS) else true end end |
#validate? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
170 |
# File 'lib/r10k/source/git.rb', line 170 def validate?; @validate end |