Class: Git::Gsub::Commands::Command
- Inherits:
-
Object
- Object
- Git::Gsub::Commands::Command
- Defined in:
- lib/git/gsub.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#options ⇒ Object
Returns the value of attribute options.
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #args ⇒ Object
-
#initialize(from, to, paths = [], options = {}) ⇒ Command
constructor
A new instance of Command.
- #run_commands(commands) ⇒ Object
Constructor Details
#initialize(from, to, paths = [], options = {}) ⇒ Command
73 74 75 76 77 78 |
# File 'lib/git/gsub.rb', line 73 def initialize(from, to, paths = [], = {}) @from = from @to = to @paths = paths = end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
71 72 73 |
# File 'lib/git/gsub.rb', line 71 def from @from end |
#options ⇒ Object
Returns the value of attribute options.
71 72 73 |
# File 'lib/git/gsub.rb', line 71 def end |
#paths ⇒ Object
Returns the value of attribute paths.
71 72 73 |
# File 'lib/git/gsub.rb', line 71 def paths @paths end |
#to ⇒ Object
Returns the value of attribute to.
71 72 73 |
# File 'lib/git/gsub.rb', line 71 def to @to end |
Instance Method Details
#args ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/git/gsub.rb', line 88 def args args = [] args << [from, to] args << [from.camelcase, to.camelcase] if [:camel] args << [from.underscore, to.underscore] if [:snake] args << [from.underscore.dasherize, to.underscore.dasherize] if [:kebab] args.compact end |
#run_commands(commands) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/git/gsub.rb', line 80 def run_commands(commands) if [:dry] commands.each { |args| puts Array(args).join(' ') } else commands.each { |args| Open3.capture3(*args) } end end |