lib/rews/restriction.rb in rews-0.1.0 vs lib/rews/restriction.rb in rews-0.2.0
- old
+ new
@@ -1,20 +1,23 @@
-# takes restrictions written in Ruby s-expressions and
-# outputs Exchange Web Services Restriction XML
-#
-#
module Rews
+ # models Restrictions for <tt>find_*</tt> operations
+ # on <tt>Folder::BaseFolderId</tt>
+ #
+ # takes restrictions written in Ruby s-expressions and
+ # outputs Exchange Web Services Restriction XML. e.g.
+ #
+ # <tt>[[:and, [:==, "item:Subject", "hello"], [:>=, "item:DateTimeSent", DateTime.parse("2011-03-16T15:57:37+00:00")]]</tt>
class Restriction
attr_reader :expr
def initialize(expr)
@expr = expr
end
def inspect
- "#{self.class}: #{@expr.inspect}"
+ "#<#{self.class} @expr=#{@expr.inspect}>"
end
def to_xml
Xml::write_restriction(expr)
end
@@ -79,10 +82,12 @@
:or => :Or,
:not => :Not
}
def write_logical(xml, expr)
xml.t LOGICAL_OPS[expr[0]] do
- write_xml(xml ,expr[1..-1])
+ expr[1..-1].each do |clause|
+ Xml::write_expr(xml, clause)
+ end
end
end
end
end
end