Class: CalFilter::ResourceWrapper
- Inherits:
-
Object
- Object
- CalFilter::ResourceWrapper
- Includes:
- TripIt
- Defined in:
- lib/calfilter.rb,
lib/calfilter/tripit.rb
Overview
A filtering wrapper for an Icalendar resource object. The wrapped object will be one of:
All unrecognized methods are delegated to the underlying resource object, so methods such as #description and #summary work as expected. (The resource object can be accessed directly using the #__delegate__ method.)
In addition to delegating to the resource, ResourceWrapper objects provide a few additional methods:
-
#_delegate_
-
#keep
-
#remove
Direct Known Subclasses
Constant Summary
Constants included from TripIt
Instance Method Summary collapse
-
#__action__ ⇒ Object
:nodoc:.
-
#__delegate__ ⇒ Object
Provides access to the underlying resource being wrapped.
-
#__kind__ ⇒ Object
:nodoc:.
-
#initialize(delegate, kind) ⇒ ResourceWrapper
constructor
:nodoc:.
-
#keep ⇒ Object
Marks this resource to be kept in the calendar.
-
#method_missing(symbol, *args, &block) ⇒ Object
:nodoc:.
-
#remove ⇒ Object
Marks this resource for removal from the calendar.
Methods included from TripIt
Constructor Details
#initialize(delegate, kind) ⇒ ResourceWrapper
:nodoc:
45 46 47 48 |
# File 'lib/calfilter.rb', line 45 def initialize(delegate, kind) # :nodoc: @delegate = delegate @kind = kind end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
:nodoc:
81 82 83 |
# File 'lib/calfilter.rb', line 81 def method_missing(symbol, *args, &block) # :nodoc: __delegate__.send(symbol, *args, &block) end |
Instance Method Details
#__action__ ⇒ Object
:nodoc:
55 56 57 |
# File 'lib/calfilter.rb', line 55 def __action__ # :nodoc: @keep_or_remove || :default end |
#__delegate__ ⇒ Object
Provides access to the underlying resource being wrapped.
51 52 53 |
# File 'lib/calfilter.rb', line 51 def __delegate__ @delegate end |
#__kind__ ⇒ Object
:nodoc:
59 60 61 |
# File 'lib/calfilter.rb', line 59 def __kind__ # :nodoc: @kind end |
#keep ⇒ Object
Marks this resource to be kept in the calendar.
If this is called on some resources, all others in the collection will be removed. For a particular kind of resource (e.g., events, todos, journals) in a given calendar, you can call either #remove or #keep on some of the resources, but not both.
77 78 79 |
# File 'lib/calfilter.rb', line 77 def keep __flag__ :keep end |
#remove ⇒ Object
Marks this resource for removal from the calendar. For a particular kind of resource (e.g., events, todos, journals) in a given calendar, you can call either #remove or #keep on some of the resources, but not both.
67 68 69 |
# File 'lib/calfilter.rb', line 67 def remove __flag__ :remove end |