Class: Chinacity::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/chinacity/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Cli

Returns a new instance of Cli.



14
15
16
17
18
19
# File 'lib/chinacity/cli.rb', line 14

def initialize options
  @short    = options[:short]
  @foramt   = options[:format]
  @minimize = options[:minimize]
  @headless = options[:headless]
end

Instance Method Details

#startObject



21
22
23
24
25
26
27
28
# File 'lib/chinacity/cli.rb', line 21

def start
  doc = Nokogiri::HTML(get_data)
  get_cities(doc)

  add_short_name if @short

  @foramt == :json ? output_json : output_csv
end