Module: Iqvoc::Configuration::Core::ClassMethods
- Defined in:
- lib/iqvoc/configuration/core.rb
Instance Method Summary collapse
- #ability_class ⇒ Object
-
#all_languages ⇒ Object
returns a list of all languages selectable for labels and/or notes.
- #change_note_class ⇒ Object
-
#config(&block) ⇒ Object
************** instance configuration **************.
- #engine? ⇒ Boolean
- #first_level_classes ⇒ Object
- #host_version ⇒ Object
- #note_languages ⇒ Object
- #root ⇒ Object
- #routing_constraint ⇒ Object
- #searchable_classes ⇒ Object
- #title ⇒ Object
- #title=(value) ⇒ Object deprecated Deprecated.
Instance Method Details
#ability_class ⇒ Object
182 183 184 |
# File 'lib/iqvoc/configuration/core.rb', line 182 def ability_class ability_class_name.constantize end |
#all_languages ⇒ Object
returns a list of all languages selectable for labels and/or notes
195 196 197 198 199 |
# File 'lib/iqvoc/configuration/core.rb', line 195 def all_languages (Iqvoc::Concept.pref_labeling_languages + Iqvoc::Concept.further_labeling_class_names.values.flatten + note_languages).compact.map(&:to_s).uniq end |
#change_note_class ⇒ Object
170 171 172 |
# File 'lib/iqvoc/configuration/core.rb', line 170 def change_note_class change_note_class_name.constantize end |
#config(&block) ⇒ Object
************** instance configuration **************
161 162 163 164 165 166 167 168 |
# File 'lib/iqvoc/configuration/core.rb', line 161 def config(&block) cfg = Iqvoc::Configuration::InstanceConfiguration.instance if block block.call(cfg) else return cfg end end |
#engine? ⇒ Boolean
207 208 209 |
# File 'lib/iqvoc/configuration/core.rb', line 207 def engine? Iqvoc.const_defined?(:Engine) end |
#first_level_classes ⇒ Object
178 179 180 |
# File 'lib/iqvoc/configuration/core.rb', line 178 def first_level_classes self.first_level_class_configuration_modules.map { |mod| mod.send(:base_class) } end |
#host_version ⇒ Object
226 227 228 229 230 |
# File 'lib/iqvoc/configuration/core.rb', line 226 def host_version if Iqvoc.host_namespace Iqvoc.host_namespace::VERSION end end |
#note_languages ⇒ Object
190 191 192 |
# File 'lib/iqvoc/configuration/core.rb', line 190 def note_languages config['languages.notes'] end |
#root ⇒ Object
211 212 213 214 215 216 217 |
# File 'lib/iqvoc/configuration/core.rb', line 211 def root if engine? Iqvoc::Engine.root else Rails.root end end |
#routing_constraint ⇒ Object
219 220 221 222 223 224 |
# File 'lib/iqvoc/configuration/core.rb', line 219 def routing_constraint lambda do |params, req| langs = Iqvoc::Concept.pref_labeling_languages.join('|').presence || 'en' return params[:lang].to_s =~ /^#{langs}$/ end end |
#searchable_classes ⇒ Object
174 175 176 |
# File 'lib/iqvoc/configuration/core.rb', line 174 def searchable_classes searchable_class_names.keys.map(&:constantize) end |
#title ⇒ Object
186 187 188 |
# File 'lib/iqvoc/configuration/core.rb', line 186 def title config['title'] end |
#title=(value) ⇒ Object
Deprecated.
202 203 204 205 |
# File 'lib/iqvoc/configuration/core.rb', line 202 def title=(value) ActiveSupport::Deprecation.warn 'title has been moved into instance configuration', caller self.config.register_setting('title', value) end |