Module: CalFilter
- Defined in:
- lib/calfilter.rb,
lib/calfilter/cgi.rb,
lib/calfilter/tripit.rb,
lib/calfilter/version.rb
Defined Under Namespace
Modules: TripIt Classes: CGIWrapper, CalendarWrapper, FilterError, ResourceWrapper
Constant Summary collapse
- CGIWRAPPER =
make_cgi_wrapper
- VERSION =
"1.2.1"
Class Method Summary collapse
-
.keep_or_delete_items(items, type, actions) ⇒ Object
:nodoc:.
-
.make_cgi_wrapper ⇒ Object
:nodoc:.
-
.output_stream ⇒ Object
The output stream for filtered icalendar output.
-
.output_stream=(stream) ⇒ Object
Sets output_stream.
-
.wrap_calendar(cal) ⇒ Object
:nodoc:.
-
.wrap_resource(res, plural_resource_type) ⇒ Object
:nodoc:.
Class Method Details
.keep_or_delete_items(items, type, actions) ⇒ Object
:nodoc:
234 235 236 237 238 239 240 241 242 |
# File 'lib/calfilter.rb', line 234 def self.keep_or_delete_items(items, type, actions) # :nodoc: if actions.include?(:keep) && actions.include?(:remove) raise CalFilter::FilterError, "Cannot both keep and remove #{type} in the same group.", caller(2) end keep_action = (actions.include?(:keep) ? :keep : :default) kept_items = [] items.each_with_index{|item, i| kept_items << item if actions[i] == keep_action} kept_items end |
.make_cgi_wrapper ⇒ Object
:nodoc:
45 46 47 |
# File 'lib/calfilter/cgi.rb', line 45 def self.make_cgi_wrapper # :nodoc: CGIWrapper.new(StringIO.new) end |
.output_stream ⇒ Object
The output stream for filtered icalendar output. If this is not nil, filter_calendars will automatically write the filtered calendars to this stream in icalendar format.
12 13 14 |
# File 'lib/calfilter.rb', line 12 def self.output_stream @output_stream end |
.output_stream=(stream) ⇒ Object
Sets output_stream.
17 18 19 |
# File 'lib/calfilter.rb', line 17 def self.output_stream=(stream) @output_stream = stream end |
.wrap_calendar(cal) ⇒ Object
:nodoc:
224 225 226 |
# File 'lib/calfilter.rb', line 224 def self.wrap_calendar(cal) # :nodoc: CalendarWrapper.new(cal) end |
.wrap_resource(res, plural_resource_type) ⇒ Object
:nodoc:
228 229 230 231 232 |
# File 'lib/calfilter.rb', line 228 def self.wrap_resource(res, plural_resource_type) # :nodoc: # This works with the particular resource names in Icalendar: singular_resource_type = plural_resource_type.sub(/s$/, '') ResourceWrapper.new(res, singular_resource_type) end |