aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/people_list.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-04-23 11:37:38 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-04-23 11:37:38 +0100
commitca99b0dff974d2fc841d7132d03b3ad1d1bf9b1e (patch)
tree69f949ec5c8a3396222815eacf9109d516de8c84 /lib/mauve/people_list.rb
parentc3592bdf6fce6f234de37959c677f75d97b1134d (diff)
People/PeopleLists can now specify individualy notification times/frequencies
* Added PeopleList builder * Added Person#during, PeopleList#during, Person#every, PeopleList#every * Notification now uses #during/#every from the Person/PeopleList if nothing was specified * Added tests
Diffstat (limited to 'lib/mauve/people_list.rb')
-rw-r--r--lib/mauve/people_list.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/mauve/people_list.rb b/lib/mauve/people_list.rb
index 6b2ba33..1890ab1 100644
--- a/lib/mauve/people_list.rb
+++ b/lib/mauve/people_list.rb
@@ -9,7 +9,7 @@ module Mauve
#
class PeopleList
- attr_reader :label, :list
+ attr_reader :label, :list, :during, :every
# Create a new list
#
@@ -20,10 +20,28 @@ module Mauve
raise ArgumentError, "people_list label must be a string" unless label.is_a?(String)
@label = label
@list = []
+ @during = nil
+ @every = nil
end
alias username label
+ #
+ #
+ #
+ def during=(arg)
+ raise "during must be a block" unless arg.is_a?(Proc)
+ @during = arg
+ end
+
+ #
+ #
+ #
+ def every=(arg)
+ raise ArgumentError, "every must be numeric" unless arg.is_a?(Numeric)
+ @every = arg
+ end
+
# Append an Array or String to a list
#
# @param [Array or String] arr