Class: Xeme::Messages

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/xeme.rb

Overview

This object holds the arrays of errors, warnings, and notes. It can mostly be treated like a hash. The main difference between a Xeme::Messages object and a hash is that any? returns true or false based on if there are any messages, not if there are any elements in the hash.

Instance Method Summary collapse

Constructor Details

#initializeMessages

new() takes no parameters.



513
514
515
516
517
518
# File 'lib/xeme.rb', line 513

def initialize
  @hsh = {}
  @hsh['errors'] = []
  @hsh['warnings'] = []
  @hsh['notes'] = []
end

Instance Method Details

#any?Boolean

Returns if there are any messages in any of the errors, warnings, or notes arrays.

Returns:

  • (Boolean)


532
533
534
535
536
537
538
# File 'lib/xeme.rb', line 532

def any?
  @hsh.values.each do |arr|
    arr.any? and return true
  end
  
  return false
end