Sha256: 9454ef70c0a601765aa7654327ff7213312eaf68566e4684d45d24d2e396f0e9

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

module Castronaut

  class TicketResult
    InvalidMessageCategories = %w{warn error fatal invalid} 

    attr_reader :ticket, :message, :message_category
    delegate :identifier, :proxies, :to => :ticket
        
    def initialize(ticket, message=nil, message_category=nil)
      @ticket = ticket
      @message = message
      @message_category = message_category
      Castronaut.logger.info("#{self.class} - #{@message_category} #{@message} for #{@ticket}") if @message && @ticket
    end

    def valid?
      !invalid?
    end
    
    def invalid?
      InvalidMessageCategories.any?{ |cat| message_category.to_s.downcase.include?(cat) }
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
masover-castronaut-0.4.4.5 lib/castronaut/ticket_result.rb