Class: DailyRep::Configer
- Inherits:
-
Object
- Object
- DailyRep::Configer
- Defined in:
- lib/dailyrep/Loadconfig.rb
Class Method Summary collapse
-
.enabled_entities ⇒ Object
+.
- .exctract_entity_params(entity, parameter_name) ⇒ Object
-
.get_client_tokens ⇒ Object
+.
-
.get_search_strs(entity) ⇒ Object
def self.include_search_strs? entity result = false result = true if @@config_json[entity][P_SEARCH_STRS] return result end.
- .index_path ⇒ Object
-
.is_entity_enabled?(entity) ⇒ Boolean
+.
- .is_phase_enabled?(phase) ⇒ Boolean
- .method_missing(meth, *args, &block) ⇒ Object
- .push_note_title ⇒ Object
- .raise_error? ⇒ Boolean
- .set_index_file(file) ⇒ Object
Class Method Details
.enabled_entities ⇒ Object
+
101 102 103 104 105 |
# File 'lib/dailyrep/Loadconfig.rb', line 101 def self.enabled_entities @@config_json[PA_ENTITIES].keys.map { |entity| entity.downcase.capitalize if is_entity_enabled?(entity) } end |
.exctract_entity_params(entity, parameter_name) ⇒ Object
85 86 87 |
# File 'lib/dailyrep/Loadconfig.rb', line 85 def self.exctract_entity_params entity, parameter_name @@config_json[PA_ENTITIES][entity][parameter_name] end |
.get_client_tokens ⇒ Object
+
107 108 109 |
# File 'lib/dailyrep/Loadconfig.rb', line 107 def self.get_client_tokens @@config_json[P_PUSH_CLIENTS].values end |
.get_search_strs(entity) ⇒ Object
def self.include_search_strs? entity
result = false
result = true if @@config_json[PA_ENTITIES][entity][P_SEARCH_STRS]
return result
end
117 118 119 |
# File 'lib/dailyrep/Loadconfig.rb', line 117 def self.get_search_strs entity @@config_json[PA_ENTITIES][entity][P_SEARCH_STRS] end |
.index_path ⇒ Object
73 74 75 |
# File 'lib/dailyrep/Loadconfig.rb', line 73 def self.index_path @@config_json[P_INDEX_PATH] end |
.is_entity_enabled?(entity) ⇒ Boolean
+
93 94 95 96 97 98 99 |
# File 'lib/dailyrep/Loadconfig.rb', line 93 def self.is_entity_enabled? entity time_arr = @@config_json[PA_ENTITIES][entity][P_TIME_FRAME].split('..').map { |el| el.to_i } (time_arr[0]..time_arr[1]).include?(Time.now.hour) && @@config_json[PA_ENTITIES][entity][P_ENABLED].to_bool end |
.is_phase_enabled?(phase) ⇒ Boolean
89 90 91 |
# File 'lib/dailyrep/Loadconfig.rb', line 89 def self.is_phase_enabled? phase @@config_json[PA_APP_CYCLE][phase].to_bool end |
.method_missing(meth, *args, &block) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/dailyrep/Loadconfig.rb', line 121 def self.method_missing(meth, *args, &block) method_inputs = meth.to_s.split('_') out_param = '' @@config_json[PA_ENTITIES].keys.each { |key| if method_inputs[0] == key.downcase out_param = self.exctract_entity_params method_inputs[0], method_inputs[1] end } super if not @@config_json[PA_ENTITIES].keys.include?(method_inputs[0]) return out_param end |
.push_note_title ⇒ Object
77 78 79 |
# File 'lib/dailyrep/Loadconfig.rb', line 77 def self.push_note_title @@config_json[P_PUSH_NOTE_TITLE] end |
.raise_error? ⇒ Boolean
81 82 83 |
# File 'lib/dailyrep/Loadconfig.rb', line 81 def self.raise_error? @@config_json[P_RAISE_ERRORS].to_bool end |
.set_index_file(file) ⇒ Object
67 68 69 |
# File 'lib/dailyrep/Loadconfig.rb', line 67 def self.set_index_file file @@config_json[P_INDEX_PATH] = file end |