Class: TDiary::TDiaryView
- Inherits:
-
TDiaryBase
- Object
- TDiaryBase
- TDiary::TDiaryView
- Defined in:
- lib/tdiary/view.rb
Overview
class TDiaryView
base of view mode classes
Direct Known Subclasses
Constant Summary
Constants inherited from TDiaryBase
TDiary::TDiaryBase::DIRTY_COMMENT, TDiary::TDiaryBase::DIRTY_DIARY, TDiary::TDiaryBase::DIRTY_NONE, TDiary::TDiaryBase::DIRTY_REFERER
Instance Attribute Summary
Attributes inherited from TDiaryBase
#cgi, #conf, #cookies, #date, #diaries, #ignore_parser_cache, #rhtml
Instance Method Summary collapse
-
#initialize(cgi, rhtml, conf) ⇒ TDiaryView
constructor
A new instance of TDiaryView.
- #last_modified ⇒ Object
Methods inherited from TDiaryBase
Methods included from ViewHelper
Constructor Details
#initialize(cgi, rhtml, conf) ⇒ TDiaryView
Returns a new instance of TDiaryView.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tdiary/view.rb', line 7 def initialize( cgi, rhtml, conf ) super unless referer_filter( @cgi.referer ) def @cgi.referer; nil; end end # save referer to latest if (!@conf.referer_day_only or (@cgi.params['date'][0] and @cgi.params['date'][0].length == 8)) and @cgi.referer then ym = latest_month @date = ym ? Time::local( ym[0], ym[1] ) : Time::now @io.transaction( @date ) do |diaries| @diaries = diaries dirty = DIRTY_NONE @diaries.keys.sort.reverse_each do |key| @diary = @diaries[key] break if @diary.visible? end if @diary then @diary.add_referer( @cgi.referer ) dirty = DIRTY_REFERER end dirty end @date = @diary.date if @diary end end |
Instance Method Details
#last_modified ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/tdiary/view.rb', line 35 def last_modified lm = Time::at( 0 ) @diaries.each_value do |diary| lmd = diary.last_modified lm = lmd if lm < lmd and diary.visible? end lm end |