Module: Iqvoc::Configuration::Core::ClassMethods

Defined in:
lib/iqvoc/configuration/core.rb

Instance Method Summary collapse

Instance Method Details

#ability_classObject



160
161
162
# File 'lib/iqvoc/configuration/core.rb', line 160

def ability_class
  ability_class_name.constantize
end

#all_languagesObject

returns a list of all languages selectable for labels and/or notes



173
174
175
176
177
# File 'lib/iqvoc/configuration/core.rb', line 173

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_classObject



148
149
150
# File 'lib/iqvoc/configuration/core.rb', line 148

def change_note_class
  change_note_class_name.constantize
end

#concept_modal_preview_enabled?Boolean

Returns:

  • (Boolean)


185
186
187
# File 'lib/iqvoc/configuration/core.rb', line 185

def concept_modal_preview_enabled?
  config['concept_modal_preview'] == true
end

#config(&block) ⇒ Object

************** instance configuration **************



139
140
141
142
143
144
145
146
# File 'lib/iqvoc/configuration/core.rb', line 139

def config(&block)
  cfg = Iqvoc::Configuration::InstanceConfiguration.instance
  if block
    block.call(cfg)
  else
    return cfg
  end
end

#engine?Boolean

Returns:

  • (Boolean)


189
190
191
# File 'lib/iqvoc/configuration/core.rb', line 189

def engine?
  Iqvoc.const_defined?(:Engine)
end

#first_level_classesObject



156
157
158
# File 'lib/iqvoc/configuration/core.rb', line 156

def first_level_classes
  self.first_level_class_configuration_modules.map { |mod| mod.send(:base_class) }
end

#host_versionObject



208
209
210
211
212
# File 'lib/iqvoc/configuration/core.rb', line 208

def host_version
  if Iqvoc.host_namespace
    Iqvoc.host_namespace::VERSION
  end
end

#note_languagesObject



168
169
170
# File 'lib/iqvoc/configuration/core.rb', line 168

def note_languages
  config['languages.notes']
end

#rootObject



193
194
195
196
197
198
199
# File 'lib/iqvoc/configuration/core.rb', line 193

def root
  if engine?
    Iqvoc::Engine.root
  else
    Rails.root
  end
end

#routing_constraintObject



201
202
203
204
205
206
# File 'lib/iqvoc/configuration/core.rb', line 201

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_classesObject



152
153
154
# File 'lib/iqvoc/configuration/core.rb', line 152

def searchable_classes
  searchable_class_names.keys.map(&:constantize)
end

#titleObject



164
165
166
# File 'lib/iqvoc/configuration/core.rb', line 164

def title
  config['title']
end

#title=(value) ⇒ Object

Deprecated.


180
181
182
183
# File 'lib/iqvoc/configuration/core.rb', line 180

def title=(value)
  ActiveSupport::Deprecation.warn 'title has been moved into instance configuration', caller
  self.config.register_setting('title', value)
end