Class: Castronaut::TicketResult
- Inherits:
-
Object
- Object
- Castronaut::TicketResult
- Defined in:
- lib/castronaut/ticket_result.rb
Constant Summary collapse
- InvalidMessageCategories =
%w{warn error fatal invalid}
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#message_category ⇒ Object
readonly
Returns the value of attribute message_category.
-
#ticket ⇒ Object
readonly
Returns the value of attribute ticket.
Instance Method Summary collapse
-
#initialize(ticket, message = nil, message_category = nil) ⇒ TicketResult
constructor
A new instance of TicketResult.
- #invalid? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(ticket, message = nil, message_category = nil) ⇒ TicketResult
Returns a new instance of TicketResult.
9 10 11 12 13 14 |
# File 'lib/castronaut/ticket_result.rb', line 9 def initialize(ticket, =nil, =nil) @ticket = ticket @message = @message_category = Castronaut.logger.info("#{self.class} - #{@message_category} #{@message} for #{@ticket}") if @message && @ticket end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/castronaut/ticket_result.rb', line 6 def @message end |
#message_category ⇒ Object (readonly)
Returns the value of attribute message_category.
6 7 8 |
# File 'lib/castronaut/ticket_result.rb', line 6 def @message_category end |
#ticket ⇒ Object (readonly)
Returns the value of attribute ticket.
6 7 8 |
# File 'lib/castronaut/ticket_result.rb', line 6 def ticket @ticket end |
Instance Method Details
#invalid? ⇒ Boolean
20 21 22 |
# File 'lib/castronaut/ticket_result.rb', line 20 def invalid? InvalidMessageCategories.any?{ |cat| .to_s.downcase.include?(cat) } end |
#valid? ⇒ Boolean
16 17 18 |
# File 'lib/castronaut/ticket_result.rb', line 16 def valid? !invalid? end |