summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/zorglub/node.rb12
-rw-r--r--spec/spec_helper.rb4
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index a9e4874..980398d 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -13,7 +13,7 @@ module Zorglub
#
class << self
#
- attr_reader :hooks, :inherited_vars, :layout, :engine
+ attr_reader :hooks, :inherited_vars, :layout, :engine, :static
#
def inherited sub
sub.layout! layout||(self==Zorglub::Node ? Config.layout : nil )
@@ -34,9 +34,9 @@ module Zorglub
@layout = layout
end
#
- def static val=nil
+ def static! val
@static = val if (val==true or val==false)
- @static ||=false
+ @static ||= false
end
#
def inherited_var sym, *args
@@ -207,8 +207,12 @@ module Zorglub
File.join(Config.layout_base_path, @options[:layout])+ext
end
#
- def static val=nil
+ def static! val
@options[:static] = val if (val==true or val==false)
+ @options[:static] ||= false
+ end
+ #
+ def static
return nil if not @options[:static] or @options[:view].nil?
File.join(Config.static_base_path, @options[:view])+ext
end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 90bfc10..18c057c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -149,9 +149,9 @@ class Node6 < Zorglub::Node
attr_accessor :static_cpt
end
attr_reader :value
- static true
+ static! true
def no_static
- static false
+ static! false
engine! 'static'
view! Node0.r('do_render')
Node6.static_cpt+=1