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 **************.
- #first_level_classes ⇒ 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
181 182 183 |
# File 'lib/iqvoc/configuration/core.rb', line 181 def ability_class ability_class_name.constantize end |
#all_languages ⇒ Object
returns a list of all languages selectable for labels and/or notes
194 195 196 197 198 |
# File 'lib/iqvoc/configuration/core.rb', line 194 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
169 170 171 |
# File 'lib/iqvoc/configuration/core.rb', line 169 def change_note_class change_note_class_name.constantize end |
#config(&block) ⇒ Object
************** instance configuration **************
160 161 162 163 164 165 166 167 |
# File 'lib/iqvoc/configuration/core.rb', line 160 def config(&block) cfg = InstanceConfiguration.instance if block block.call(cfg) else return cfg end end |
#first_level_classes ⇒ Object
177 178 179 |
# File 'lib/iqvoc/configuration/core.rb', line 177 def first_level_classes self.first_level_class_configuration_modules.map { |mod| mod.send(:base_class) } end |
#note_languages ⇒ Object
189 190 191 |
# File 'lib/iqvoc/configuration/core.rb', line 189 def note_languages config['languages.notes'] end |
#root ⇒ Object
206 207 208 209 210 211 212 |
# File 'lib/iqvoc/configuration/core.rb', line 206 def root if Iqvoc.const_defined?(:Engine) Iqvoc::Engine.root else Rails.root end end |
#routing_constraint ⇒ Object
214 215 216 217 218 219 |
# File 'lib/iqvoc/configuration/core.rb', line 214 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
173 174 175 |
# File 'lib/iqvoc/configuration/core.rb', line 173 def searchable_classes searchable_class_names.keys.map(&:constantize) end |
#title ⇒ Object
185 186 187 |
# File 'lib/iqvoc/configuration/core.rb', line 185 def title config['title'] end |
#title=(value) ⇒ Object
Deprecated.
201 202 203 204 |
# File 'lib/iqvoc/configuration/core.rb', line 201 def title=(value) ActiveSupport::Deprecation.warn 'title has been moved into instance configuration', caller self.config.register_setting('title', value) end |