Class: TDiary::TDiaryMonth

Inherits:
TDiaryMonthBase show all
Defined in:
lib/tdiary/view.rb

Overview

class TDiaryMonth

show month mode view

Direct Known Subclasses

TDiaryMonthWithoutFilter

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

Methods inherited from TDiaryMonthBase

#eval_rhtml

Methods inherited from TDiaryView

#last_modified

Methods inherited from TDiaryBase

#[], #calendar, #eval_rhtml, #last_modified

Methods included from ViewHelper

#base_url, #bot?

Constructor Details

#initialize(cgi, rhtml, conf) ⇒ TDiaryMonth

Returns a new instance of TDiaryMonth.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/tdiary/view.rb', line 253

def initialize( cgi, rhtml, conf )
	super

	begin
		date = Time::local( *@cgi.params['date'][0].scan( /^(\d{4})(\d\d)$/ )[0] )
		d1 = @date.dup.gmtime if @date
		d2 = date.dup.gmtime
		if not @date or d1.year != d2.year or d1.month != d2.month then
			@date = date
			@io.transaction( @date ) do |diaries|
				@diaries = diaries
				@diary = @diaries[@diaries.keys.sort.reverse[0]]
				DIRTY_NONE
			end
		end
	rescue ArgumentError, NameError
		raise TDiaryError, 'bad date'
	end
end