class Notice

Attributes

notice_date[RW]

Public Class Methods

new() click to toggle source
# File lib/notice.rb, line 6
def initialize
  @notices = []
  @alert_notices = []
  @warning_notices = []
  @watch_notices = []
end

Public Instance Methods

add_alert(alert) click to toggle source
# File lib/notice.rb, line 92
def add_alert(alert)
  @notices << alert
  @alert_notices << alert
end
add_warning(warning) click to toggle source
# File lib/notice.rb, line 102
def add_warning(warning)
  @notices << warning
  @warning_notices << warning
end
add_watch(watch) click to toggle source
# File lib/notice.rb, line 97
def add_watch(watch)
  @notices << watch
  @watch_notices << watch
end
alerts() click to toggle source
# File lib/notice.rb, line 79
def alerts
  @alert_notices
end
display_alerts() click to toggle source
# File lib/notice.rb, line 28
def display_alerts
  if self.alerts.empty?
    puts "***************************"
    puts "There are no current alerts."
    puts "***************************"
  else
     self.alerts.each.with_index(1) do |notice,i|
       puts "**************************"
       puts  "#{i}. #{notice.title}"
       puts notice.summary
       puts notice.readmore
     end
   end
 end
display_notices() click to toggle source
# File lib/notice.rb, line 13
def display_notices
  if self.notices.empty?
    puts "***************************"
    puts "There are no current notices."
    puts "***************************"
  else
    self.notices.each.with_index(1) do |notice,i|
      puts "**************************"
      puts  "#{i}. #{notice.title}"
      puts notice.summary
      puts notice.readmore
    end
  end
end
display_warnings() click to toggle source
# File lib/notice.rb, line 43
def display_warnings
  if self.warnings.empty?
    puts "***************************"
    puts "There are no current warnings."
    puts "***************************"
  else
    self.warnings.each.with_index(1) do |notice,i|
       puts "**************************"
       puts  "#{i}. #{notice.title}"
       puts notice.summary
       puts notice.readmore
    end
  end
end
display_watches() click to toggle source
# File lib/notice.rb, line 58
def display_watches
  if self.watches.empty?
    puts "***************************"
    puts "There are no current watches."
    puts "***************************"
  else
     self.watches.each.with_index(1) do |notice,i|
       puts "**************************"
       puts  "#{i}. #{notice.title}"
       puts notice.summary
       puts notice.readmore
     end
   end
 end
notices() click to toggle source
# File lib/notice.rb, line 75
def notices
  @notices
end
warnings() click to toggle source
# File lib/notice.rb, line 83
def warnings
  @warning_notices
end
watches() click to toggle source
# File lib/notice.rb, line 87
def watches
  @watch_notices
end