Class: Sesc::Cli

Inherits:
Object
  • Object
show all
Includes:
Options
Defined in:
lib/sesc/cli.rb,
lib/sesc/cli/filter.rb,
lib/sesc/cli/options.rb

Defined Under Namespace

Modules: Filter, Options

Constant Summary

Constants included from Options

Options::COMMANDS_WITH_OPTIONS, Options::DEFAULT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Options

#help?, #index_for, #places?

Constructor Details

#initialize(args) ⇒ Cli

Returns a new instance of Cli.



9
10
11
# File 'lib/sesc/cli.rb', line 9

def initialize(args)
  self.args = args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



7
8
9
# File 'lib/sesc/cli.rb', line 7

def args
  @args
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/sesc/cli.rb', line 13

def call
  return Sesc::Exporter::Help.print if help?
  if places?
    Sesc::Exporter::Places.print
  elsif Sesc::Cities.include?(city)
    Sesc.send(city, number, places)
  else
    Sesc::Exporter::Printer.new("Cidade #{city} não encontrada").terminal
  end
end