Class: TDiary::TDiaryBase

Inherits:
Object
  • Object
show all
Includes:
ERB::Util, ViewHelper
Defined in:
lib/tdiary/base.rb

Overview

class TDiaryBase

tDiary CGI

Constant Summary collapse

DIRTY_NONE =
0
DIRTY_DIARY =
1
DIRTY_COMMENT =
2
DIRTY_REFERER =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ViewHelper

#base_url, #bot?

Constructor Details

#initialize(cgi, rhtml, conf) ⇒ TDiaryBase

Returns a new instance of TDiaryBase.



19
20
21
22
23
24
25
# File 'lib/tdiary/base.rb', line 19

def initialize( cgi, rhtml, conf )
	@cgi, @rhtml, @conf = cgi, rhtml, conf
	@diaries = {}
	@cookies = []
	@io = @conf.io_class.new( self )
	@ignore_parser_cache = false
end

Instance Attribute Details

#cgiObject (readonly)

Returns the value of attribute cgi.



16
17
18
# File 'lib/tdiary/base.rb', line 16

def cgi
  @cgi
end

#confObject (readonly)

Returns the value of attribute conf.



16
17
18
# File 'lib/tdiary/base.rb', line 16

def conf
  @conf
end

#cookiesObject (readonly)

Returns the value of attribute cookies.



15
16
17
# File 'lib/tdiary/base.rb', line 15

def cookies
  @cookies
end

#dateObject (readonly)

Returns the value of attribute date.



15
16
17
# File 'lib/tdiary/base.rb', line 15

def date
  @date
end

#diariesObject (readonly)

Returns the value of attribute diaries.



15
16
17
# File 'lib/tdiary/base.rb', line 15

def diaries
  @diaries
end

#ignore_parser_cacheObject (readonly)

Returns the value of attribute ignore_parser_cache.



17
18
19
# File 'lib/tdiary/base.rb', line 17

def ignore_parser_cache
  @ignore_parser_cache
end

#rhtmlObject (readonly)

Returns the value of attribute rhtml.



16
17
18
# File 'lib/tdiary/base.rb', line 16

def rhtml
  @rhtml
end

Instance Method Details

#[](date) ⇒ Object



45
46
47
# File 'lib/tdiary/base.rb', line 45

def []( date )
	@diaries[date.strftime( '%Y%m%d' )]
end

#calendarObject



49
50
51
# File 'lib/tdiary/base.rb', line 49

def calendar
	@years = @io.calendar unless @years
end

#eval_rhtml(prefix = '') ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/tdiary/base.rb', line 27

def eval_rhtml( prefix = '' )
	begin
		r = do_eval_rhtml( prefix )
	rescue PluginError, SyntaxError, ArgumentError, Exception => e
		if e.class == ForceRedirect
			raise
		else
			body = File.read("#{File.dirname(__FILE__)}/../../views/plugin_error.rhtml")
			r = ERB.new(body).result(binding)
		end
	end
	r
end

#last_modifiedObject



41
42
43
# File 'lib/tdiary/base.rb', line 41

def last_modified
	nil
end