Class: CachedPage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, contentType) ⇒ CachedPage

Returns a new instance of CachedPage.



507
508
509
510
511
# File 'lib/ribit/action.rb', line 507

def initialize( data, contentType )
  @data = data
  @contentType = contentType
  @lastModified = Time.now
end

Instance Attribute Details

#contentTypeObject (readonly)

Returns the value of attribute contentType.



504
505
506
# File 'lib/ribit/action.rb', line 504

def contentType
  @contentType
end

#dataObject (readonly)

Returns the value of attribute data.



504
505
506
# File 'lib/ribit/action.rb', line 504

def data
  @data
end

Instance Method Details

#is_time_same_or_after(lastModifiedHttpDate) ⇒ Object



514
515
516
517
518
519
520
521
522
523
524
525
# File 'lib/ribit/action.rb', line 514

def is_time_same_or_after( lastModifiedHttpDate )

  time = Time.httpdate( lastModifiedHttpDate )
    
  # NOTE: @lastModified time contains also fraction of seconds but httpdate
  #       doesn't have them => we have to compare full seconds
  if ( ( time.to_i <=> @lastModified.to_i ) >= 0 )
    return true
  end
  
  return false
end

#lastModfiedHttpdateObject



528
529
530
# File 'lib/ribit/action.rb', line 528

def lastModfiedHttpdate
  @lastModified.httpdate
end