Arie/serveme

View on GitHub
app/decorators/server_decorator.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

class ServerDecorator < Draper::Decorator
  include Draper::LazyHelpers
  delegate_all

  def name
    flag + object.name
  end

  def flag
    if flag_abbreviation
      tag.span '', class: "flags flags-#{flag_abbreviation}", title: location.name
    else
      ''
    end
  end

  def flag_abbreviation
    location&.flag
  end
end