Class: LEWT::CalendarTimekeeping
- Defined in:
- lib/extensions/calendar-timekeeping/calendar-timekeeping.rb
Instance Attribute Summary
Attributes inherited from Extension
#command_name, #customers, #enterprise, #lewt_settings, #lewt_stash, #options
Instance Method Summary collapse
-
#extract(options) ⇒ Object
Extracts data from a given calender source based on what was passed in the
options['ext_method']
parameter. -
#initialize ⇒ CalendarTimekeeping
constructor
Sets up this extension and registers its options.
Methods inherited from Extension
#get_matched_customers, #lewt_extensions
Constructor Details
#initialize ⇒ CalendarTimekeeping
Sets up this extension and registers its options.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/extensions/calendar-timekeeping/calendar-timekeeping.rb', line 28 def initialize # set extension options = { :calendar => { :default => "ical", :definition => "The calender extraction method to use, supports 'ical', 'osx' calender extraction. Defaults to ical.", :type => String, }, :suppress => { :definition => "Suppresses the cost calculation for the specified targets when calulating the hourly rates on extracted calender data.", :type => String } } super({:cmd => "calendar", :options => }) end |
Instance Method Details
#extract(options) ⇒ Object
Extracts data from a given calender source based on what was passed in the options['ext_method']
parameter.
- options [Hash]
-
The options hash passed to this function by the Lewt program.
- returns
-
LEWTBook
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/extensions/calendar-timekeeping/calendar-timekeeping.rb', line 47 def extract( ) targetCustomers = self.get_matched_customers( [:target], [:suppress] ) dStart = [:start] dEnd = [:end] suppressTargets = [:suppress] == nil ? nil : self.get_matched_customers([:suppress]) if [:calendar] == "ical" extract = CalendarExtractors::ICalExtractor.new( dStart, dEnd, targetCustomers, lewt_settings, suppressTargets ) elsif [:calendar] == "osx" extract = CalendarExtractors::AppleExtractor.new(dStart, dEnd, targetCustomers, lewt_settings, suppressTargets ) end return extract.data end |