Class: Resume::DateRange

Inherits:
Object
  • Object
show all
Defined in:
lib/resume.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#end_dateObject

Returns the value of attribute end_date.



360
361
362
# File 'lib/resume.rb', line 360

def end_date
  @end_date
end

#start_dateObject

Returns the value of attribute start_date.



359
360
361
# File 'lib/resume.rb', line 359

def start_date
  @start_date
end

Class Method Details

.scaffold(year1, year2) ⇒ Object



362
363
364
365
366
367
# File 'lib/resume.rb', line 362

def DateRange.scaffold(year1,year2)
    range = DateRange.new
    range.start_date=Date.ordinal(year1,1)
    range.end_date=Date.ordinal(year2,1)
    range
end

Instance Method Details

#<=>(other_range) ⇒ Object



369
370
371
# File 'lib/resume.rb', line 369

def <=>(other_range)
    return @start_date <=> other_range.start_date
end

#to_sObject



373
374
375
376
377
378
379
# File 'lib/resume.rb', line 373

def to_s
    if (@end_date)
        return "#{start_date.month}/#{start_date.year} - #{end_date.month}/#{end_date.year}"
    else
        return "#{start_date.month}/#{start_date.year} - present"
    end
end