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

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, rule = nil) ⇒ NumberedSpan

Returns a new instance of NumberedSpan.



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

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

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



5
6
7
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 5

def source
  @source
end

Instance Method Details

#==(another) ⇒ Object



15
16
17
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 15

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

#ordinalObject



23
24
25
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 23

def ordinal
  @source
end

#to_sObject



19
20
21
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 19

def to_s
  source.to_s
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/ri_cal/property_value/recurrence_rule/numbered_span.rb', line 11

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