lib/phonelib/core.rb in phonelib-0.8.5 vs lib/phonelib/core.rb in phonelib-0.8.6
- old
+ new
@@ -2,9 +2,16 @@
# main module that includes all basic data and methods
module Core
# @private variable will include hash with data for validation
@@phone_data = nil
+ # eagerly initialize the gem, loads data into memory. not required, initialization is done lazily otherwise, but
+ # may be desirable in production enviroments to avoid initialization time on first use.
+ def eager_load!
+ phone_data
+ phone_ext_data
+ end
+
# getter for phone data for other modules of gem, can be used outside
# @return [Hash] all data for phone parsing
def phone_data
@@phone_data ||= load_data.freeze
end