hanami-view 1.2.1 → 1.3.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bd8111fc0f2c00a03f7a4020932a2f35f672e8fd93a7db28865fb8c4116053b
4
- data.tar.gz: 4b3b34acf3bc9dd63f58866d5c023063c94826add5d8ad54baa522030ee5185b
3
+ metadata.gz: 9f100d8a194322c23df67578b55d851460fcca93fb7c4302f5a73478829ca079
4
+ data.tar.gz: f6952d1e8d562ad3de2bdf281a906bf5db7e152f9725769cf92a487ef6ccb44a
5
5
  SHA512:
6
- metadata.gz: a66c97948ce7e2838e5a9772157ac9850c81f382caf278dc62a1e2123ca186d802111ee6699199a0d659433caeed868379be4a63626fd9bf3ed1c8c6a74264de
7
- data.tar.gz: 774d9cb89c4300314420042be8873cfc463e9fc2858ae2d7fcc2676ac6e5176d6fc53883b77ddd565bbc5c17a880982b76af6820e5aecfa254fa43c4a379da7d
6
+ metadata.gz: 2e47e684ee507d0ee4977fc03f8d2808876b0b0d77b954152eafe8900b369ea0a4d3be7ba52e9342791ef14bb3a575ade092e8c65126b0e54ae235693d4abf62
7
+ data.tar.gz: ad9e79bf19fe03863ee01ff57e652116b7d218bfa64b5aa25d8b439d9ff87047de19d419a7317c43e7512ffdae89cbf6fe4f0bd7e59996d603cfb2034bece1c9
@@ -1,13 +1,10 @@
1
1
  # Hanami::View
2
2
  View layer for Hanami
3
3
 
4
- ## v1.2.1 - 2018-10-16
5
- ### Added
6
- - [Luca Guidi] Introduced new, backward compatible, signature to render a layout for testing purposes (eg. `ApplicationLayout.new({ format: :html }, "contents").render`)
7
-
4
+ ## v1.3.0.beta1 - 2018-08-08
8
5
  ### Fixed
9
- - [Luca Guidi] Ensure layout to be rendered when using HAML 5
10
- - [Luca Guidi] Ensure to raise `NoMethodError` when an unknown method is invoked by a view/template
6
+ - [Ferdinand Niedermann] Ensure to set `:disable_escape` option only for Slim and don't let Tilt to emit a warning for other template engines.
7
+ - [glaszig] Ensure partial rendering to respect `format` overriding
11
8
 
12
9
  ## v1.2.0 - 2018-04-06
13
10
 
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.required_ruby_version = '>= 2.3.0'
21
21
 
22
22
  spec.add_runtime_dependency 'tilt', '~> 2.0', '>= 2.0.1'
23
- spec.add_runtime_dependency 'hanami-utils', '~> 1.2'
23
+ spec.add_runtime_dependency 'hanami-utils', '~> 1.3.beta'
24
24
 
25
25
  spec.add_development_dependency 'bundler', '~> 1.5'
26
26
  spec.add_development_dependency 'rspec', '~> 3.7'
@@ -2,7 +2,6 @@ require 'hanami/utils/class_attribute'
2
2
  require 'hanami/view/rendering/layout_registry'
3
3
  require 'hanami/view/rendering/layout_scope'
4
4
  require 'hanami/view/rendering/null_layout'
5
- require 'hanami/view/rendering/null_view'
6
5
 
7
6
  module Hanami
8
7
  # Layout
@@ -117,12 +116,7 @@ module Hanami
117
116
 
118
117
  # Initialize a layout
119
118
  #
120
- # @param scope [Hanami::View::Rendering::Scope,::Hash] view rendering scope.
121
- # Optionally a scope can be expressed as a Ruby `::Hash`, but it MUST contain
122
- # the `:format` key, to specify which template to render.
123
- # @option scope [Symbol] :format the format to render (e.g. `:html`, `:xml`, `:json`)
124
- # This is mandatory only if a `:Hash` is passed as `scope`.
125
- #
119
+ # @param scope [Hanami::View::Rendering::Scope] view rendering scope
126
120
  # @param rendered [String] the output of the view rendering process
127
121
  #
128
122
  # @api private
@@ -130,19 +124,7 @@ module Hanami
130
124
  #
131
125
  # @see Hanami::View::Rendering#render
132
126
  def initialize(scope, rendered)
133
- # NOTE: This complex data transformation is due to a combination of a bug and the intent of maintaing backward compat (SemVer).
134
- # See https://github.com/hanami/view/pull/156
135
- s, r = *case scope
136
- when ::Hash
137
- [Hanami::View::Rendering::Scope.new(Hanami::View::Rendering::NullView, scope), rendered]
138
- when Hanami::View::Template
139
- [Hanami::View::Rendering::Scope.new(Hanami::View::Rendering::NullView, rendered.merge(format: scope.format)), ""]
140
- else
141
- [scope, rendered]
142
- end
143
-
144
- @scope = View::Rendering::LayoutScope.new(self, s)
145
- @rendered = r
127
+ @scope, @rendered = View::Rendering::LayoutScope.new(self, scope), rendered
146
128
  end
147
129
 
148
130
  # Render the layout
@@ -92,7 +92,7 @@ module Hanami
92
92
  def self.for(base)
93
93
  # TODO this implementation is similar to Hanami::Controller::Configuration consider to extract it into Hanami::Utils
94
94
  namespace = Utils::String.namespace(base)
95
- framework = Utils::Class.load_from_pattern!("(#{namespace}|Hanami)::View")
95
+ framework = Utils::Class.load("#{namespace}::View") || Utils::Class.load!('Hanami::View')
96
96
  framework.configuration
97
97
  end
98
98
 
@@ -196,7 +196,7 @@ module Hanami
196
196
  # view = IndexView.new(template, {article: article})
197
197
  #
198
198
  # view.article # => #<Article:0x007fb0bbd3b6e8>
199
- def method_missing(m, *)
199
+ def method_missing(m)
200
200
  @scope.__send__ m
201
201
  end
202
202
  end
@@ -66,7 +66,7 @@ module Hanami
66
66
  when Symbol, String
67
67
  # TODO Move this low level logic into a Hanami::Utils solution
68
68
  class_name = "#{ Utils::String.classify(layout) }#{ SUFFIX }"
69
- namespace = Utils::Class.load_from_pattern!(namespace)
69
+ namespace = Utils::Class.load!(namespace)
70
70
  namespace.const_get(class_name)
71
71
  when Class
72
72
  layout
@@ -3,6 +3,6 @@ module Hanami
3
3
  # Defines the version
4
4
  #
5
5
  # @since 0.1.0
6
- VERSION = '1.2.1'.freeze
6
+ VERSION = '1.3.0.beta1'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-16 00:00:00.000000000 Z
11
+ date: 2018-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '1.2'
39
+ version: 1.3.beta
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '1.2'
46
+ version: 1.3.beta
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +113,6 @@ files:
113
113
  - lib/hanami/view/rendering/null_layout.rb
114
114
  - lib/hanami/view/rendering/null_local.rb
115
115
  - lib/hanami/view/rendering/null_template.rb
116
- - lib/hanami/view/rendering/null_view.rb
117
116
  - lib/hanami/view/rendering/options.rb
118
117
  - lib/hanami/view/rendering/partial.rb
119
118
  - lib/hanami/view/rendering/partial_file.rb
@@ -144,9 +143,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
143
  version: 2.3.0
145
144
  required_rubygems_version: !ruby/object:Gem::Requirement
146
145
  requirements:
147
- - - ">="
146
+ - - ">"
148
147
  - !ruby/object:Gem::Version
149
- version: '0'
148
+ version: 1.3.1
150
149
  requirements: []
151
150
  rubyforge_project:
152
151
  rubygems_version: 2.7.7
@@ -1,26 +0,0 @@
1
- module Hanami
2
- module View
3
- module Rendering
4
- # Null Object pattern for view
5
- #
6
- # It's used when a layout is rendered direcly for testing purposes
7
- #
8
- # @api private
9
- # @since 1.2.1
10
- class NullView
11
- # Render the layout template
12
- #
13
- # @return [String] an empty string
14
- #
15
- # @api private
16
- # @since 1.2.1
17
- #
18
- # @see Hanami::Layout#render
19
- # @see Hanami::View::Rendering#render
20
- def render
21
- ""
22
- end
23
- end
24
- end
25
- end
26
- end