summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/zorglub/app.rb19
-rw-r--r--lib/zorglub/node.rb10
-rw-r--r--lib/zorglub/rack_session.rb4
-rw-r--r--lib/zorglub/session.rb4
4 files changed, 13 insertions, 24 deletions
diff --git a/lib/zorglub/app.rb b/lib/zorglub/app.rb
index 43b03b7..9619968 100644
--- a/lib/zorglub/app.rb
+++ b/lib/zorglub/app.rb
@@ -78,11 +78,10 @@ module Zorglub
end
def register_engine! name, ext, proc
- return unless name
if ext.nil? or ext.empty?
x = nil
else
- x = (ext[0]=='.' ? (ext.length==1 ? nil : ext) : '.'+ext)
+ x = (ext[0]=='.' ? (ext.length==1 ? nil : ext) : '.' + ext)
end
@options[:engines][name]=[ proc, x ]
end
@@ -94,20 +93,20 @@ module Zorglub
end
def view_base_path
- p = @options[:view_path]
- ( p.nil? ? File.join(@options[:root], @options[:view_dir]) : p )
+ _base_path @options[:view_path], :view_dir
end
def layout_base_path
- p = @options[:layout_path]
- ( p.nil? ? File.join(@options[:root], @options[:layout_dir]) : p )
+ _base_path @options[:layout_path], :layout_dir
end
def static_base_path
- p = @options[:static_path]
- ( p.nil? ? File.join(@options[:root], @options[:static_dir]) : p )
+ _base_path @options[:static_path], :static_dir
+ end
+
+ private
+ def _base_path p, sym
+ ( p.nil? ? File.join(@options[:root], @options[sym]) : p )
end
end
end
-#
-# EOF
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index 42b0304..d1a075a 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -74,7 +74,7 @@ module Zorglub
def layout
return nil if @layout.nil?
- File.join(self.class.layout_base_path, @layout)+ext
+ File.join(self.class.layout_base_path, @layout) + ext
end
def no_view!
@@ -87,7 +87,7 @@ module Zorglub
def view
return nil if @view.nil?
- File.join(self.class.view_base_path, @view)+ext
+ File.join(self.class.view_base_path, @view) + ext
end
def static! val, lifetime=0
@@ -97,11 +97,11 @@ module Zorglub
def static
return nil if not @static or @view.nil?
- File.join(app.static_base_path, @view)+ext
+ File.join(app.static_base_path, @view) + ext
end
def ext! ext
- @ext = ( (ext.nil? or ext.empty?) ? nil : (ext[0]=='.' ? (ext.length==1 ? nil : ext) : '.'+ext) )
+ @ext = ( (ext.nil? or ext.empty?) ? nil : (ext[0]=='.' ? (ext.length==1 ? nil : ext) : '.' + ext) )
end
def ext
@@ -332,5 +332,3 @@ module Zorglub
end
end
-
-# EOF
diff --git a/lib/zorglub/rack_session.rb b/lib/zorglub/rack_session.rb
index b7c19fc..d08cd84 100644
--- a/lib/zorglub/rack_session.rb
+++ b/lib/zorglub/rack_session.rb
@@ -1,13 +1,9 @@
# -*- coding: UTF-8 -*-
module Zorglub
-
class Node
-
def session
@request.session
end
-
end
-
end
diff --git a/lib/zorglub/session.rb b/lib/zorglub/session.rb
index db36fd2..fc5fdbe 100644
--- a/lib/zorglub/session.rb
+++ b/lib/zorglub/session.rb
@@ -148,9 +148,5 @@ module Zorglub
Digest::SHA2.hexdigest(entropy.join)
end
end
-
end
-
end
-
-# EOF