Class: ToTown::CLI

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

Instance Method Summary collapse

Instance Method Details

#checkObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/to_town/cli.rb', line 20

def check
  points = ToTown.check(options[:lat].to_f, options[:lng].to_f, options[:limit])
        points.each do |point|
          puts %{ #{point.name} #{point.state}\t
                  type: #{point.town_type}\t
                  latitude: #{point.latlng[0]}\t
                  longitude: #{point.latlng[1]}\t
                  land area: #{point.aland}\t
                  water area: #{point.awater}
                }
        end
end

#config(db_name = 'mongo') ⇒ Object



34
35
36
37
38
39
# File 'lib/to_town/cli.rb', line 34

def config(db_name='mongo')
  case db_name
  when "mongo"
    ToTown::Generators::Mongodb.start
  end
end

#populateObject



12
13
14
# File 'lib/to_town/cli.rb', line 12

def populate
  ToTown::Converter::Us.run
end