Class: RiCal::PropertyValue::RecurrenceRule::NumberedSpan

Inherits:
Object
  • Object
show all
Defined in:
lib/ri_cal/property_value/recurrence_rule/numbered_span.rb

Overview

  • ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, rule = nil) ⇒ NumberedSpan

Returns a new instance of NumberedSpan.



8
9
10
11
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 8

def initialize(source, rule = nil)
  @source = source
  @rule = rule
end

Instance Attribute Details

#sourceObject (readonly)

:nodoc:



7
8
9
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 7

def source
  @source
end

Instance Method Details

#==(another) ⇒ Object



17
18
19
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 17

def  ==(another)
  self.class == another.class && source == another.source
end

#ordinalObject



25
26
27
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 25

def ordinal
  @source
end

#to_sObject



21
22
23
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 21

def to_s
  source.to_s
end

#valid?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 13

def valid?
  (1..last).include?(source) || (-last..-1).include?(source)
end