Class: Brainzlab::Components::MaturityBadge
- Defined in:
- lib/brainzlab/components/maturity_badge.rb
Overview
Signals how production-ready a platform service is. Honesty rule: a scaffold/early service must render as :proximamente (not yet), never as :disponible.
Constant Summary collapse
- LEVELS =
{ disponible: { class: 'badge-disponible', label: 'Disponible' }, beta: { class: 'badge-beta', label: 'Beta' }, proximamente: { class: 'badge-proximamente', label: 'Próximamente' } }.freeze
Instance Method Summary collapse
-
#initialize(level: :beta, label: nil, **attrs) ⇒ MaturityBadge
constructor
A new instance of MaturityBadge.
- #view_template ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(level: :beta, label: nil, **attrs) ⇒ MaturityBadge
Returns a new instance of MaturityBadge.
15 16 17 18 19 |
# File 'lib/brainzlab/components/maturity_badge.rb', line 15 def initialize(level: :beta, label: nil, **attrs) @level = LEVELS.key?(level) ? level : :beta @label = label @attrs = attrs end |
Instance Method Details
#view_template ⇒ Object
21 22 23 |
# File 'lib/brainzlab/components/maturity_badge.rb', line 21 def view_template span(class: badge_classes, **@attrs.except(:class)) { @label || LEVELS[@level][:label] } end |