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(request, rhtml, conf) ⇒ TDiaryBase

Returns a new instance of TDiaryBase.



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

def initialize( request, rhtml, conf )
	@request = request
	# plugins read the request through the @cgi facade
	@cgi = request.cgi_compat
	@rhtml, @conf = 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

#requestObject (readonly)

Returns the value of attribute request.



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

def request
  @request
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



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

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

#calendarObject



52
53
54
# File 'lib/tdiary/base.rb', line 52

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

#eval_rhtml(prefix = '') ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/tdiary/base.rb', line 30

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



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

def last_modified
	nil
end