Class: Obfusc::ShowCommand
- Inherits:
-
Object
- Object
- Obfusc::ShowCommand
- Defined in:
- lib/obfusc/commands/show_command.rb
Overview
Perform tasks related ‘show` command
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config, source) ⇒ ShowCommand
constructor
A new instance of ShowCommand.
- #run ⇒ Object
- #show_usage ⇒ Object
Constructor Details
#initialize(config, source) ⇒ ShowCommand
Returns a new instance of ShowCommand.
7 8 9 10 |
# File 'lib/obfusc/commands/show_command.rb', line 7 def initialize(config, source) @config = config @source = source end |
Class Method Details
.call(config, *args) ⇒ Object
12 13 14 15 16 |
# File 'lib/obfusc/commands/show_command.rb', line 12 def self.call(config, *args) source = args.first model = new(config, source) model.public_send(File.exist?(source.to_s) ? :run : :show_usage) end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 |
# File 'lib/obfusc/commands/show_command.rb', line 18 def run files.each do |from, to| puts "#{from}:" puts "---> #{to}" end end |
#show_usage ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/obfusc/commands/show_command.rb', line 25 def show_usage usage = <<-TEXT.gsub(' ', '') Usage: $ obfusc show <source> Files: source: Relative or absolute directory where obfuscated files are stored. (Default to current directory) TEXT puts usage end |