Class: IpFilter::Providers::MaxMind
- Inherits:
-
Object
- Object
- IpFilter::Providers::MaxMind
- Defined in:
- lib/ip_filter/providers/max_mind.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
- #config ⇒ Object
- #folder ⇒ Object
-
#initialize ⇒ MaxMind
constructor
A new instance of MaxMind.
- #refresh_file_list! ⇒ Object
- #update! ⇒ Object
Constructor Details
#initialize ⇒ MaxMind
Returns a new instance of MaxMind.
8 9 10 11 12 13 |
# File 'lib/ip_filter/providers/max_mind.rb', line 8 def initialize check_geoipupdate_presence! refresh_file_list! update! if @files.empty? return @files end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
6 7 8 |
# File 'lib/ip_filter/providers/max_mind.rb', line 6 def files @files end |
Instance Method Details
#config ⇒ Object
24 25 26 |
# File 'lib/ip_filter/providers/max_mind.rb', line 24 def config @config ||= IpFilter.configuration.geoipupdate_config end |
#folder ⇒ Object
28 29 30 |
# File 'lib/ip_filter/providers/max_mind.rb', line 28 def folder @folder ||= IpFilter.configuration.data_folder end |
#refresh_file_list! ⇒ Object
32 33 34 |
# File 'lib/ip_filter/providers/max_mind.rb', line 32 def refresh_file_list! @files = Dir["#{folder}/*.dat"] end |
#update! ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/ip_filter/providers/max_mind.rb', line 15 def update! # Execute geoipupdate command. if %x{geoipupdate -f #{config} -d #{folder}} refresh_file_list! return true end return false end |