Class: RuneBlog::View
- Inherits:
-
Object
show all
- Includes:
- Helpers
- Defined in:
- lib/runeblog_version.rb,
lib/view.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Helpers
#copy_data, #find_draft_slugs, #get_repo_config, #new_sequence, #quit_RubyText, #read_features, #read_vars, #retrieve_views, #subdirs, #write_repo_config
Constructor Details
#initialize(name) ⇒ View
Returns a new instance of View.
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/view.rb', line 9
def initialize(name)
log!(enter: __method__, args: [name], level: 3)
raise NoBlogAccessor if RuneBlog.blog.nil?
@blog = RuneBlog.blog
@name = name
@publisher = RuneBlog::Publishing.new(name)
@can_publish = true @blog.view = self
get_globals
end
|
Instance Attribute Details
#globals ⇒ Object
Returns the value of attribute globals.
4
5
6
|
# File 'lib/view.rb', line 4
def globals
@globals
end
|
#name ⇒ Object
Returns the value of attribute name.
4
5
6
|
# File 'lib/view.rb', line 4
def name
@name
end
|
#publisher ⇒ Object
Returns the value of attribute publisher.
5
6
7
|
# File 'lib/view.rb', line 5
def publisher
@publisher
end
|
#state ⇒ Object
Returns the value of attribute state.
4
5
6
|
# File 'lib/view.rb', line 4
def state
@state
end
|
Instance Method Details
#can_publish? ⇒ Boolean
45
46
47
|
# File 'lib/view.rb', line 45
def can_publish?
@can_publish
end
|
#dir ⇒ Object
29
30
31
|
# File 'lib/view.rb', line 29
def dir
@blog.root + "/views/#@name/"
end
|
#get_globals ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/view.rb', line 20
def get_globals
gfile = @blog.root/"views/#{name}/themes/standard/global.lt3"
return unless File.exist?(gfile)
live = Livetext.customize(call: ".nopara")
live.xform_file(gfile)
@globals = live.vars
end
|
#index ⇒ Object
37
38
39
|
# File 'lib/view.rb', line 37
def index
dir + "index.html"
end
|
#local_index ⇒ Object
33
34
35
|
# File 'lib/view.rb', line 33
def local_index
dir + "/remote/index.html"
end
|
#recent?(file) ⇒ Boolean
49
50
51
52
53
|
# File 'lib/view.rb', line 49
def recent?(file)
File.mtime(file) > File.mtime("#{self.dir()}/last_published")
rescue
true
end
|
#to_s ⇒ Object
41
42
43
|
# File 'lib/view.rb', line 41
def to_s
@name
end
|