Class: Selene::EventBuilder
- Inherits:
-
ComponentBuilder
- Object
- ComponentBuilder
- Selene::EventBuilder
- Defined in:
- lib/selene/event_builder.rb
Constant Summary collapse
- REQUIRED_PROPERTIES =
These properties are required
%w(dtstamp uid)
- DISTINCT_PROPERTIES =
These properties must not occur more than once
%w(dtstamp uid dtstart class created description geo last-mod location organizer priority seq status summary transp url recurid)
- EXCLUSIVE_PROPERTIES =
These properties must not occur together in the same component
[ %w(dtend duration)
Instance Attribute Summary
Attributes inherited from ComponentBuilder
Instance Method Summary collapse
- #component_rules(component) ⇒ Object
- #parent=(builder) ⇒ Object
-
#value(line) ⇒ Object
single_property :rrule, :except => when? if dtstart is a date, dtend has to be too multi-day durations must be ‘dur-day’ or ‘dur-week’.
Methods inherited from ComponentBuilder
#a_component_rules, #add, #initialize, #name, #parse, #valid?
Methods included from ComponentRules
Constructor Details
This class inherits a constructor from Selene::ComponentBuilder
Instance Method Details
#component_rules(component) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/selene/event_builder.rb', line 37 def component_rules(component) super(component).tap do |rules| rules["Property 'dtstart' required if the calendar does not specify a 'method' property"] = lambda do || return if @component.key?('dtstart') || parent && parent.component.key?('method') @errors << { :message => } end end end |
#parent=(builder) ⇒ Object
32 33 34 35 |
# File 'lib/selene/event_builder.rb', line 32 def parent=(builder) raise Exception.new("Event components cannot be nested inside anything but a calendar component") unless builder.is_a?(CalendarBuilder) super(builder) end |
#value(line) ⇒ Object
single_property :rrule, :except => when? if dtstart is a date, dtend has to be too multi-day durations must be ‘dur-day’ or ‘dur-week’
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/selene/event_builder.rb', line 21 def value(line) case line.name when 'dtstamp', 'dtstart', 'dtend' line.value_with_params when 'geo' line.values else super end end |