Module: Iqvoc::Configuration::Core::ClassMethods
- Defined in:
- lib/iqvoc/configuration/core.rb
Instance Method Summary collapse
- #ability_class ⇒ Object
- #available_languages ⇒ Object
- #available_languages=(value) ⇒ Object deprecated Deprecated.
- #change_note_class ⇒ Object
-
#config(&block) ⇒ Object
************** instance configuration **************.
- #first_level_classes ⇒ Object
- #generate_secret_token ⇒ Object
- #searchable_classes ⇒ Object
- #title ⇒ Object
- #title=(value) ⇒ Object deprecated Deprecated.
Instance Method Details
#ability_class ⇒ Object
143 144 145 |
# File 'lib/iqvoc/configuration/core.rb', line 143 def ability_class ability_class_name.constantize end |
#available_languages ⇒ Object
151 152 153 |
# File 'lib/iqvoc/configuration/core.rb', line 151 def available_languages return config["available_languages"] end |
#available_languages=(value) ⇒ Object
Deprecated.
162 163 164 165 |
# File 'lib/iqvoc/configuration/core.rb', line 162 def available_languages=(value) ActiveSupport::Deprecation.warn "available_languages has been moved into instance configuration", caller self.config.register_setting("available_languages", value) end |
#change_note_class ⇒ Object
131 132 133 |
# File 'lib/iqvoc/configuration/core.rb', line 131 def change_note_class change_note_class_name.constantize end |
#config(&block) ⇒ Object
************** instance configuration **************
122 123 124 125 126 127 128 129 |
# File 'lib/iqvoc/configuration/core.rb', line 122 def config(&block) cfg = InstanceConfiguration.instance if block block.call(cfg) else return cfg end end |
#first_level_classes ⇒ Object
139 140 141 |
# File 'lib/iqvoc/configuration/core.rb', line 139 def first_level_classes self.first_level_class_configuration_modules.map { |mod| mod.send(:base_class) } end |
#generate_secret_token ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/iqvoc/configuration/core.rb', line 101 def generate_secret_token require 'securerandom' template = Rails.root.join("config", "initializers", "secret_token.rb.template") raise "File not found: #{template}" unless File.exist?(template) file_name = "config/initializers/secret_token.rb" token = SecureRandom.hex(64) txt = File.read(template) txt.gsub!("S-E-C-R-E-T", token) File.open(file_name, "w") do |f| f.write txt end puts "Secret token configuration has been created in #{file_name}." end |
#searchable_classes ⇒ Object
135 136 137 |
# File 'lib/iqvoc/configuration/core.rb', line 135 def searchable_classes searchable_class_names.map(&:constantize) end |
#title ⇒ Object
147 148 149 |
# File 'lib/iqvoc/configuration/core.rb', line 147 def title return config["title"] end |
#title=(value) ⇒ Object
Deprecated.
156 157 158 159 |
# File 'lib/iqvoc/configuration/core.rb', line 156 def title=(value) ActiveSupport::Deprecation.warn "title has been moved into instance configuration", caller self.config.register_setting("title", value) end |