wouter-views 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0abf8d37f44198537c29e9c34e48cccc60eb2d40dffdc2b3d7be3fbdbd3588a
4
- data.tar.gz: c79ede543b1aea588aa25b66ddd1a252a9721ffcdfc40d8059d20f35ef161fbd
3
+ metadata.gz: 7900e2aa3f22e5e229a4b074f68faf576229a8118bdc7af964e42135a594ba8e
4
+ data.tar.gz: 816bedcdcee8f65bd1c4e09480e8eb15635fceb425de977aa07993b3018100e8
5
5
  SHA512:
6
- metadata.gz: fcf8c5767f4d8eb4b51d0082c0b091e9b3885f251a72bc250aac0d958f55f237d17acf5d88c14502e6e9e35330a6591cc7642d448a44882ab973af843364ea67
7
- data.tar.gz: db9e97e15fe4e582463e8bd5ddbf34b9c9781d0a2445004cdfe6117d0a8853632d547ab1603572a58fe7d1ea5b97c987dfe586a84f8e1351369e73334c9de1e1
6
+ metadata.gz: 81b8085539529232ace513b020aa9cb6dc3d7046cf1eea9904a6e0b958232d1ee43ec4ef1036e9eddc43ce2b8bb3b918cbd28696a37d2dca8e25c3cd28e9f651
7
+ data.tar.gz: c5fa7b42062c11071c211503beecb956d27de42b275464570ca2e25d9c7677fc5da4097ee7ec307a8dda59ff76f2378e03ea67506d91c6644940d6eb69873282
data/lib/wouter/views.rb CHANGED
@@ -29,34 +29,36 @@ end
29
29
 
30
30
  class Wouter
31
31
  class <<self
32
- def render_template(template, bind = self, engine = nil)
33
- dir = @view_dir || File.expand_path('./views')
34
- engine = engine || @view_engine || :html
32
+ def render_template(template, bind = self, engine = nil, dir = nil)
33
+ dir = dir || config[:view_dir] || File.expand_path('./views')
34
+ engine = engine || config[:view_engine] || :html
35
35
  Wouter::Views.file_finder(dir, template, engine, bind)
36
36
  end
37
37
 
38
- def render_view(template, engine: nil)
39
- lambda { |env|
38
+ def render_view(template, engine: nil, dir: nil)
39
+ lambda { |env, _config|
40
40
  response = Rack::Response.new
41
- response.write render_template(template, self, engine)
41
+ response.write render_template(template, self, engine, dir)
42
42
  response.finish
43
43
  }
44
44
  end
45
45
 
46
46
  def view_dir(dir = nil)
47
- @view_dir = dir unless dir.nil?
48
- @view_dir
47
+ config[:view_dir] = dir unless dir.nil?
48
+ config[:view_dir]
49
49
  end
50
50
 
51
51
  def view_engine(engine = nil)
52
- @view_engine = engine unless engine.nil?
53
- @view_engine
52
+ config[:view_engine] = engine unless engine.nil?
53
+ config[:view_engine]
54
54
  end
55
55
  end
56
56
 
57
57
  class Endpoint
58
- def render_view(template, engine: nil)
59
- Wouter.render_template(template, self, engine)
58
+ def render_view(template, engine: nil, dir: nil)
59
+ engine ||= config[:view_engine]
60
+ dir ||= config[:view_dir]
61
+ Wouter.render_template(template, self, engine, dir)
60
62
  end
61
63
  end
62
64
  end
data/wouter-views.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'wouter-views'
5
5
  s.platform = Gem::Platform::RUBY
6
- s.version = '0.0.4'
6
+ s.version = '0.0.5'
7
7
  s.summary = 'View template support for Wouter web framework.'
8
8
  s.description = 'Adds view template support to the Wouter web framework.'
9
9
  s.authors = ['Robert Peterson']
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.license = 'MIT'
14
14
  s.homepage = 'https://github.com/rawburt/wouter-views'
15
15
 
16
- s.add_dependency 'wouter', '~> 0.0.8'
16
+ s.add_dependency 'wouter', '~> 0.0.9'
17
17
  s.add_dependency 'rack', '~> 2.0', '>= 2.0.6'
18
18
  s.add_dependency 'tilt', '~> 2.0', '>= 2.0.8'
19
19
  s.add_development_dependency 'm', '~> 1.5'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wouter-views
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Peterson
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.8
19
+ version: 0.0.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.8
26
+ version: 0.0.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rack
29
29
  requirement: !ruby/object:Gem::Requirement