waves 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.8.2
@@ -7,7 +7,7 @@ module Erubis # :nodoc:
7
7
  class Context
8
8
 
9
9
  def <<(s)
10
- eval("_buf", @binding).concat s # add to rendered output
10
+ eval("_buf << '#{s}'", @binding)
11
11
  end
12
12
 
13
13
  def capture
@@ -17,7 +17,7 @@ module Erubis # :nodoc:
17
17
  result
18
18
  end
19
19
 
20
- def render(eruby)
20
+ def to_s(eruby)
21
21
  unless @binding
22
22
  @binding = binding
23
23
  eval("_buf = ''; _context = []", @binding)
@@ -49,7 +49,7 @@ module Waves
49
49
  instance_variable_set("@#{key}",val)
50
50
  end
51
51
  end
52
- context.render(eruby)
52
+ context.to_s(eruby)
53
53
  end
54
54
 
55
55
 
@@ -78,6 +78,8 @@ module Waves
78
78
  def process
79
79
  begin
80
80
  before ; body = send( request.method ) ; after
81
+ rescue Waves::Dispatchers::Redirect => e
82
+ raise e
81
83
  rescue Exception => e
82
84
  response.status = ( StatusCodes[ e.class ] || 500 )
83
85
  ( body = handler( e ) ) rescue raise e
@@ -112,7 +114,7 @@ module Waves
112
114
  def deferred? ; false ; end
113
115
 
114
116
  before {} ; after {} ; always {}
115
- handler( Waves::Dispatchers::Redirect ) { |e| raise e }
117
+ # handler( Waves::Dispatchers::Redirect ) { |e| raise e }
116
118
 
117
119
  %w( post get put delete head ).each do | method |
118
120
  on( method ) { not_found }
@@ -42,18 +42,16 @@ module Waves
42
42
  ( rname.nil? ? resource.class.paths : app::Resources[ rname ].paths ).new( request )
43
43
  end
44
44
 
45
- def basename ; @basename ||= path.sub(/\.([^\.]+)$/,'') ; end
45
+ # these take strings or operate on the path by default
46
+ def basename( str = nil ) ; ( str or path ).sub(/\.([^\.]+)$/,'') ; end
46
47
 
47
- def extension
48
- @extension ||= if ( m = path.match(/\.([^\.]+)$/) )
49
- m[1]
50
- end
48
+ def extension( str = nil )
49
+ ( m = ( str or path ).match(/\.([^\.]+)$/) ) ? m[1] : nil
51
50
  end
52
51
 
53
52
  def render( path, assigns = {} )
54
53
  Waves::Views::Base.new( request ).render( path, assigns )
55
54
  end
56
-
57
55
  end
58
56
 
59
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waves
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Yoder