Class: ManagerWithJsonData
- Inherits:
-
ManagerBase
- Object
- ManagerBase
- ManagerWithJsonData
- Defined in:
- lib/mrpin/core/with_json/manager_with_json_data.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#url_client_data ⇒ Object
readonly
properties.
Instance Method Summary collapse
- #generate_client_json ⇒ Object
-
#initialize(options = nil) ⇒ ManagerWithJsonData
constructor
A new instance of ManagerWithJsonData.
- #load_init_data ⇒ Object
- #post_init ⇒ Object
Methods inherited from ManagerBase
#cleanup_data, #info, #invalidate_cache, #is_ready_for_shutdown?, #on_data_loaded, #on_server_maintenance_on, #on_server_shutdown, #on_server_started, #start_tasks
Constructor Details
#initialize(options = nil) ⇒ ManagerWithJsonData
Returns a new instance of ManagerWithJsonData.
30 31 32 33 34 |
# File 'lib/mrpin/core/with_json/manager_with_json_data.rb', line 30 def initialize( = nil) super() @url_client_data = nil end |
Instance Attribute Details
#url_client_data ⇒ Object (readonly)
properties
7 8 9 |
# File 'lib/mrpin/core/with_json/manager_with_json_data.rb', line 7 def url_client_data @url_client_data end |
Instance Method Details
#generate_client_json ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/mrpin/core/with_json/manager_with_json_data.rb', line 73 def generate_client_json try_remove_json_old content = self.get_json_data_client path_absolute = UtilsIO.to_path_absolute(self.data_client_folder) FileUtils.mkdir_p(path_absolute) file_name = self.data_client_filename + '_' + Time.now.to_i.to_s + '.json' path_absolute_with_name = File.join(path_absolute, file_name) File.write(path_absolute_with_name, content) path_relative_with_name = UtilsIO.to_path_relative(path_absolute_with_name) @url_client_data = path_relative_with_name @logger.info("json generated: #{path_absolute_with_name}") nil end |
#load_init_data ⇒ Object
44 45 46 47 48 |
# File 'lib/mrpin/core/with_json/manager_with_json_data.rb', line 44 def load_init_data super check_json_data_client end |
#post_init ⇒ Object
37 38 39 40 41 |
# File 'lib/mrpin/core/with_json/manager_with_json_data.rb', line 37 def post_init super nil end |