Class: Mako::Errors

Inherits:
Object
  • Object
show all
Defined in:
lib/mako/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeErrors

Returns a new instance of Errors.



7
8
9
# File 'lib/mako/errors.rb', line 7

def initialize
  @messages = []
end

Instance Attribute Details

#messagesObject

Returns the value of attribute messages.



5
6
7
# File 'lib/mako/errors.rb', line 5

def messages
  @messages
end

Instance Method Details

#add_error(msg) ⇒ Object

Add an error message to the messages array

Parameters:

  • (String)


14
15
16
# File 'lib/mako/errors.rb', line 14

def add_error(msg)
  messages << msg
end

#any?Boolean

Predicate method to see if there are any error messages

Returns:

  • (Boolean)


21
22
23
# File 'lib/mako/errors.rb', line 21

def any?
  messages.count.positive?
end