class RuneBlog::View
Attributes
globals[R]
name[R]
publisher[RW]
state[R]
Public Class Methods
new(name)
click to toggle source
# 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 # FIXME # @blog.view = self # NOOOO?? get_globals end
Public Instance Methods
can_publish?()
click to toggle source
# File lib/view.rb, line 64 def can_publish? @can_publish end
dir()
click to toggle source
# File lib/view.rb, line 48 def dir @blog.root + "/views/#@name/" end
dump_globals_stderr()
click to toggle source
# File lib/view.rb, line 20 def dump_globals_stderr log!(enter: __method__, args: [list], level: 2) list2 = list.select(&block) STDERR.puts "-- globals = " log!(str: "-- globals = ") @globals.each_pair do |k, v| msg = sprintf " %-10s %s\n", k, v if k.is_a? Symbol STDERR.puts msg log!(str: msg) end STDERR.puts log!(str: "") end
get_globals(force = false)
click to toggle source
# File lib/view.rb, line 34 def get_globals(force = false) return if @globals && !force # gfile = @blog.root/"views/#@name/themes/standard/global.lt3" gfile = @blog.root/"views/#@name/data/global.lt3" return unless File.exist?(gfile) # Hackish!! how is View.new called from create_view?? live = Livetext.customize(call: ".nopara") live.xform_file(gfile) live._setvar("ViewDir", @blog.root/:views/@name) live._setvar("View", @name) @globals = live.vars # dump_globals_stderr end
index()
click to toggle source
# File lib/view.rb, line 56 def index dir + "index.html" end
local_index()
click to toggle source
# File lib/view.rb, line 52 def local_index dir + "/remote/index.html" end
recent?(file)
click to toggle source
# File lib/view.rb, line 68 def recent?(file) File.mtime(file) > File.mtime("#{self.dir()}/last_published") rescue true end
to_s()
click to toggle source
# File lib/view.rb, line 60 def to_s @name end