Class: Kojo::Commands::ToJsonCmd

Inherits:
CommandBase
  • Object
show all
Defined in:
lib/kojo/commands/to_json.rb

Overview

Handle calls to the kojo dir command

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CommandBase

#save

Instance Attribute Details

#inputObject (readonly)

Returns the value of attribute input.



9
10
11
# File 'lib/kojo/commands/to_json.rb', line 9

def input
  @input
end

#replace_filesObject (readonly)

Returns the value of attribute replace_files.



9
10
11
# File 'lib/kojo/commands/to_json.rb', line 9

def replace_files
  @replace_files
end

#save_filesObject (readonly)

Returns the value of attribute save_files.



9
10
11
# File 'lib/kojo/commands/to_json.rb', line 9

def save_files
  @save_files
end

Instance Method Details

#runObject



27
28
29
30
31
32
33
# File 'lib/kojo/commands/to_json.rb', line 27

def run
  @input = input_files
  @save_files = args['--save'] || args['--replace']
  @replace_files = args['--replace']

  save_files ? write : show
end