Class: Compose::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/compose/model.rb

Class Method Summary collapse

Class Method Details

.allObject



12
13
14
# File 'lib/compose/model.rb', line 12

def self.all
  yaml[:models]
end

.find(name) ⇒ Object



16
17
18
# File 'lib/compose/model.rb', line 16

def self.find(name)
  all.find { |model| model[:name] == name || model[:nickname] == name }
end

.preferred_verifier_modelObject



20
21
22
23
# File 'lib/compose/model.rb', line 20

def self.preferred_verifier_model
  preferred_nickname = yaml[:preferred_verifier_model]
  all.find { |model| model[:nickname] == preferred_nickname }
end

.yamlObject



5
6
7
8
9
10
# File 'lib/compose/model.rb', line 5

def self.yaml
  return @yaml if @yaml

  yaml_content = File.read(File.expand_path("../../config/models.yml", __dir__))
  @yaml = YAML.safe_load(yaml_content, symbolize_names: true)
end