Module: Space2underscore
- Defined in:
- lib/space2underscore.rb,
lib/space2underscore/version.rb
Constant Summary collapse
- VERSION =
'0.3.4'
Class Method Summary collapse
- .convert(argv) ⇒ Object
- .create_new_branch(underscore_include_sentence) ⇒ Object
- .print_usage ⇒ Object
Class Method Details
.convert(argv) ⇒ Object
5 6 7 |
# File 'lib/space2underscore.rb', line 5 def self.convert(argv) argv.length == 1 ? argv[0].strip.gsub(/\s/, '_') : argv.join('_') end |
.create_new_branch(underscore_include_sentence) ⇒ Object
9 10 11 |
# File 'lib/space2underscore.rb', line 9 def self.create_new_branch(underscore_include_sentence) system "git checkout -b #{underscore_include_sentence}" end |
.print_usage ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/space2underscore.rb', line 13 def self.print_usage = " space2underscore \#{Space2underscore::VERSION}\n Usage: space2underscore <branch name> <options>\n\n $ space2underscore new branch -c # Run with `--create` or `-c` options.\n => Switched to the new branch 'new_branch\u2019\n\n Or\n\n $ git branch -m $(space2underscore renamed branch) # space2underscore has outputted to the standard output.\n EOF\n\n print message.gsub(' ', '')\nend\n" |