hanami-helpers 1.0.0.beta1 → 1.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,6 +8,7 @@ module Hanami
8
8
  # This is a HTML5 markup builder.
9
9
  #
10
10
  # Features:
11
+ #
11
12
  # * Support for complex markup without the need of concatenation
12
13
  # * Auto closing HTML5 tags
13
14
  # * Custom tags
@@ -114,15 +114,18 @@ module Hanami
114
114
  result
115
115
  end
116
116
 
117
+ # @api private
117
118
  def boolean_attribute?(attribute_name)
118
119
  BOOLEAN_ATTRIBUTES.include?(attribute_name.to_s)
119
120
  end
120
121
 
121
122
  # Do not render boolean attributes when their value is _false_.
123
+ # @api private
122
124
  def boolean_attribute(attribute_name, _value)
123
125
  %(#{ATTRIBUTES_SEPARATOR}#{attribute_name}="#{attribute_name}")
124
126
  end
125
127
 
128
+ # @api private
126
129
  def attribute(attribute_name, value)
127
130
  %(#{ATTRIBUTES_SEPARATOR}#{attribute_name}="#{value}")
128
131
  end
@@ -1,4 +1,4 @@
1
- require 'hanami/utils' # RUBY_VERSION >= '2.2'
1
+ require 'hanami/utils'
2
2
  require 'hanami/utils/class_attribute'
3
3
  require 'hanami/utils/escape'
4
4
  require 'hanami/helpers/html_helper/empty_html_node'
@@ -42,6 +42,7 @@ module Hanami
42
42
  datalist
43
43
  del
44
44
  details
45
+ dialog
45
46
  dfn
46
47
  div
47
48
  dl
@@ -61,6 +62,7 @@ module Hanami
61
62
  h6
62
63
  head
63
64
  header
65
+ hgroup
64
66
  i
65
67
  iframe
66
68
  ins
@@ -68,7 +70,6 @@ module Hanami
68
70
  label
69
71
  legend
70
72
  li
71
- link
72
73
  main
73
74
  map
74
75
  mark
@@ -88,12 +89,14 @@ module Hanami
88
89
  q
89
90
  rp
90
91
  rt
92
+ rtc
91
93
  ruby
92
94
  s
93
95
  samp
94
96
  script
95
97
  section
96
98
  select
99
+ slot
97
100
  small
98
101
  span
99
102
  strong
@@ -115,6 +118,7 @@ module Hanami
115
118
  tr
116
119
  u
117
120
  ul
121
+ var
118
122
  video
119
123
  ).freeze
120
124
 
@@ -183,6 +187,7 @@ module Hanami
183
187
  @nodes = []
184
188
  end
185
189
 
190
+ # @api private
186
191
  def options
187
192
  end
188
193
 
@@ -294,15 +299,18 @@ module Hanami
294
299
  #
295
300
  # @example
296
301
  #
297
- # html.label do
298
- # text "Option 1"
299
- # radio_button :option, 1
300
- # end
301
- #
302
- # # <label>
303
- # # Option 1
304
- # # <input type="radio" name="option" value="1" />
305
- # # </label>
302
+ # <%=
303
+ # html.label do
304
+ # text "Option 1"
305
+ # radio_button :option, 1
306
+ # end
307
+ # %>
308
+ #
309
+ # <!-- output -->
310
+ # <label>
311
+ # Option 1
312
+ # <input type="radio" name="option" value="1" />
313
+ # </label>
306
314
  def text(content)
307
315
  @nodes << TextNode.new(content)
308
316
  self
@@ -346,16 +354,20 @@ module Hanami
346
354
  @nodes.any?
347
355
  end
348
356
 
349
- # Resolve the context for nested contents
350
- #
351
- # @since 0.1.0
352
- # @api private
353
- if RUBY_VERSION >= '2.2' && !Utils.jruby?
357
+ if !Utils.jruby?
358
+ # Resolve the context for nested contents
359
+ #
360
+ # @since 0.1.0
361
+ # @api private
354
362
  def resolve(&blk)
355
363
  @context = blk.binding.receiver
356
364
  instance_exec(&blk)
357
365
  end
358
366
  else
367
+ # Resolve the context for nested contents
368
+ #
369
+ # @since 0.1.0
370
+ # @api private
359
371
  def resolve(&blk)
360
372
  @context = eval 'self', blk.binding
361
373
  instance_exec(&blk)
@@ -32,6 +32,7 @@ module Hanami
32
32
  content.to_s
33
33
  end
34
34
 
35
+ # @api private
35
36
  def content
36
37
  result = @builder.resolve(&@blk)
37
38
 
@@ -40,6 +40,8 @@ module Hanami
40
40
  # # ERB template
41
41
  # # <%= link_to_home %>
42
42
  module RoutingHelper
43
+ # @since 0.1.0
44
+ # @api private
43
45
  def self.included(base)
44
46
  factory = "#{Utils::String.new(base).namespace}.routes"
45
47
 
@@ -3,6 +3,6 @@ module Hanami
3
3
  # Define version
4
4
  #
5
5
  # @since 0.1.0
6
- VERSION = '1.0.0.beta1'.freeze
6
+ VERSION = '1.0.0.beta2'.freeze
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta1
4
+ version: 1.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-14 00:00:00.000000000 Z
13
+ date: 2017-03-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hanami-utils