Module: ModelLabeling
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/model_labeling.rb
Overview
Shared model-name formatting for the two places a model+effort pair is resolved and shown: a Column's own policy and a Card's effective (possibly overridden) config. Kept in one place so a card face and its column can never disagree about how a model reads — the board must not misreport what spends.
Instance Method Summary collapse
-
#model_label_of(model_name, effort_name) ⇒ Object
"Opus - High" — human label from a model + optional effort.
-
#model_short_of(model_name) ⇒ Object
"claude-sonnet-4-6" → "sonnet"; passes through a non-claude name unchanged.
Instance Method Details
#model_label_of(model_name, effort_name) ⇒ Object
"Opus - High" — human label from a model + optional effort. Effort is optional, so a model with no effort renders just "Opus". Blank model → nil.
15 16 17 18 19 |
# File 'app/models/concerns/model_labeling.rb', line 15 def model_label_of(model_name, effort_name) return if model_name.blank? label = model_short_of(model_name).to_s.capitalize effort_name.present? ? "#{label} - #{effort_name.to_s.capitalize}" : label end |
#model_short_of(model_name) ⇒ Object
"claude-sonnet-4-6" → "sonnet"; passes through a non-claude name unchanged.
9 10 11 |
# File 'app/models/concerns/model_labeling.rb', line 9 def model_short_of(model_name) model_name.to_s[/claude-([a-z]+)/, 1] || model_name.presence end |