Class: TDiary::TDiaryBase

Inherits:
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.



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

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.



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

def cgi
  @cgi
end

#confObject (readonly)

Returns the value of attribute conf.



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

def conf
  @conf
end

#cookiesObject (readonly)

Returns the value of attribute cookies.



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

def cookies
  @cookies
end

#dateObject (readonly)

Returns the value of attribute date.



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

def date
  @date
end

#diariesObject (readonly)

Returns the value of attribute diaries.



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

def diaries
  @diaries
end

#ignore_parser_cacheObject (readonly)

Returns the value of attribute ignore_parser_cache.



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

def ignore_parser_cache
  @ignore_parser_cache
end

#rhtmlObject (readonly)

Returns the value of attribute rhtml.



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

def rhtml
  @rhtml
end

Instance Method Details

#[](date) ⇒ Object



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

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

#calendarObject



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

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

#eval_rhtml(prefix = '') ⇒ Object



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

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").untaint
      r = ERB.new(body).result(binding)
    end
  end
  r
end

#last_modifiedObject



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

def last_modified
  nil
end