Class: Rack::Dedos::Executables::Geoipget
- Inherits:
-
Object
- Object
- Rack::Dedos::Executables::Geoipget
- Defined in:
- lib/rack/dedos/executables/geoipget.rb
Defined Under Namespace
Classes: Maxmind
Instance Attribute Summary collapse
-
#arch ⇒ Object
readonly
Returns the value of attribute arch.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**options) ⇒ Geoipget
constructor
A new instance of Geoipget.
- #run ⇒ Object
Constructor Details
#initialize(**options) ⇒ Geoipget
Returns a new instance of Geoipget.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rack/dedos/executables/geoipget.rb', line 15 def initialize(**) @arch, @dir = 'linux_amd64', '.' OptionParser.new do |o| o. = <<~END Download the geoip database from Maxmind. Usage: #{::File.basename($0)} CONFIG_FILE END o.on('-a', '--arch ARCH', String, "architecture (default: #{arch})") { @arch = _1 } o.on('-d', '--dir DIR', String, "destination directory (default: #{dir})") { @dir = _1 } o.on('-A', '--about', 'show author/license information and exit') { self.class.about } o.on('-V', '--version', 'show version and exit') { self.class.version } end.parse! @config = ARGV.first end |
Instance Attribute Details
#arch ⇒ Object (readonly)
Returns the value of attribute arch.
13 14 15 |
# File 'lib/rack/dedos/executables/geoipget.rb', line 13 def arch @arch end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/rack/dedos/executables/geoipget.rb', line 13 def config @config end |
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
13 14 15 |
# File 'lib/rack/dedos/executables/geoipget.rb', line 13 def dir @dir end |
Class Method Details
.about ⇒ Object
35 36 37 38 |
# File 'lib/rack/dedos/executables/geoipget.rb', line 35 def self.about puts 'Written by Sven Schwyn (bitcetera.com) and distributed under MIT license.' exit end |