Sha256: 586026f08e353872b60316f8f71813c2eac4e6cf632907b4f192caacbfd6a281
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'active_support/concern' # Missing on "eac/listable" require 'active_support/hash_with_indifferent_access' require 'eac/listable' module EacLauncher module Publish class CheckResult include ::Eac::Listable lists.add_string :status, :updated, :pending, :blocked, :outdated lists.status.values.each do |status| class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 def self.#{status}(message) new('#{status}', message) end RUBY_EVAL end class << self def pending_status?(status) [STATUS_PENDING, STATUS_BLOCKED].include?(status) end def updated_color 'green' end def pending_color 'yellow' end def blocked_color 'red' end def outdated_color 'light_blue' end end attr_reader :status, :message def initialize(status, message) raise "Status \"#{status}\" not in #{self.class.lists.status.values}" unless self.class.lists.status.values.include?(status) @status = status @message = message end def to_s message.light_white.send("on_#{background_color}") end private def background_color self.class.send("#{status}_color") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eac_launcher-0.6.0 | lib/eac_launcher/publish/check_result.rb |