tubby 1.0 → 1.1

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.
Files changed (6) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +6 -1
  3. data/LICENSE.md +55 -12
  4. data/README.md +4 -14
  5. data/lib/tubby.rb +14 -3
  6. metadata +8 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 23fa67b928c22ddfe8a88d2a31d9aec059babbb7
4
- data.tar.gz: c04266360faf36cc54e517b264f978c61a47867b
2
+ SHA256:
3
+ metadata.gz: bd594f1dcbabe992d83539b79b73d98c4fe21277458b20552c1e22529f1cf6d4
4
+ data.tar.gz: 1b7361729edb772bb64f67f12c8418e10f183abc198a7e6e7728866c44006a66
5
5
  SHA512:
6
- metadata.gz: a747e3bb0a99977634b781d7892c129194e931a3b3de8d133088d74a9e542be7f5fc4308c7151e90d8ab7774d709eae34e129783540fc97366debcbad3547b5f
7
- data.tar.gz: 61e61741fee0eb09789521f77098c64ef4f4e12172da9a5aa48088fa09e120346e4849dba23778c9fd54eb157455d2168be4fbf89ea07a194f1cca546ed3d39c
6
+ metadata.gz: a365e374496d4a097eeebe187757604f576e1886493c23b226c2cbba42228d0113c99d0c84af961b841e226b4e37dda008636f4d345994b8a38fe476911f5a8c
7
+ data.tar.gz: 7060f9c5bbbe77f6e6bfea7ec7e9c4ac56ae5bc078fcb4e7d1938f18a133d0d8235ad0a143e1d01ef1730e32654a425c6188257876ec5c23f987afdf5aaa48be
@@ -1,6 +1,11 @@
1
1
  # Tubby CHANGELOG
2
2
 
3
- ## Changes since previous release
3
+ ## v1.1
4
+
5
+ - Fix warnings on Ruby 2.7 (#1, stoivo)
6
+ - Add support for data-attributes (#2, zverok)
7
+
8
+ ## v1.0
4
9
 
5
10
  - Initial implementation
6
11
 
data/LICENSE.md CHANGED
@@ -1,12 +1,55 @@
1
- Copyright (C) 2018 Magnus Holm <judofyr@gmail.com>
2
-
3
- Permission to use, copy, modify, and/or distribute this software for any
4
- purpose with or without fee is hereby granted.
5
-
6
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
7
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
8
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
9
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
- PERFORMANCE OF THIS SOFTWARE.
1
+ # Blue Oak Model License
2
+
3
+ Version 1.0.0
4
+
5
+ ## Purpose
6
+
7
+ This license gives everyone as much permission to work with
8
+ this software as possible, while protecting contributors
9
+ from liability.
10
+
11
+ ## Acceptance
12
+
13
+ In order to receive this license, you must agree to its
14
+ rules. The rules of this license are both obligations
15
+ under that agreement and conditions to your license.
16
+ You must not do anything with this software that triggers
17
+ a rule that you cannot or will not follow.
18
+
19
+ ## Copyright
20
+
21
+ Each contributor licenses you to do everything with this
22
+ software that would otherwise infringe that contributor's
23
+ copyright in it.
24
+
25
+ ## Notices
26
+
27
+ You must ensure that everyone who gets a copy of
28
+ any part of this software from you, with or without
29
+ changes, also gets the text of this license or a link to
30
+ <https://blueoakcouncil.org/license/1.0.0>.
31
+
32
+ ## Excuse
33
+
34
+ If anyone notifies you in writing that you have not
35
+ complied with [Notices](#notices), you can keep your
36
+ license by taking all practical steps to comply within 30
37
+ days after the notice. If you do not do so, your license
38
+ ends immediately.
39
+
40
+ ## Patent
41
+
42
+ Each contributor licenses you to do everything with this
43
+ software that would otherwise infringe any patent claims
44
+ they can license or become able to license.
45
+
46
+ ## Reliability
47
+
48
+ No contributor can revoke this license.
49
+
50
+ ## No Liability
51
+
52
+ ***As far as the law allows, this software comes as is,
53
+ without any warranty or condition, and no contributor
54
+ will be liable to anyone for any damages related to this
55
+ software or this license, under any kind of legal claim.***
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Tubby: Tags in Ruby
2
2
 
3
+ [![](https://img.shields.io/gem/v/tubby.svg)](https://rubygems.org/gems/tubby) [![](https://img.shields.io/travis/com/judofyr/tubby.svg)](https://travis-ci.com/judofyr/tubby)
4
+
3
5
  Tubby is a lightweight library for writing HTML components in plain Ruby.
4
6
 
5
7
  ```ruby
@@ -377,17 +379,5 @@ compatible with earlier releases with the same MAJOR version.
377
379
 
378
380
  ## License
379
381
 
380
- Tubby is is available under the 0BSD license:
381
-
382
- > Copyright (C) 2018 Magnus Holm <judofyr@gmail.com>
383
- >
384
- > Permission to use, copy, modify, and/or distribute this software for any
385
- > purpose with or without fee is hereby granted.
386
- >
387
- > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
388
- > REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
389
- > AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
390
- > INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
391
- > LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
392
- > OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
393
- > PERFORMANCE OF THIS SOFTWARE.
382
+ Tubby is is available under the Blue Oak Model License (see LICENSE.md).
383
+ This is a permissive license similar to BSD/MIT.
@@ -55,6 +55,18 @@ module Tubby
55
55
  end
56
56
 
57
57
  def __attrs!(attrs)
58
+ if attrs.key?(:data) && attrs[:data].is_a?(Hash)
59
+ # Flatten present `data: {k1: v1, k2: v2}` attribute, inserting `data-k1: v1, data-k2: v2`
60
+ # into exact place where the attribute was
61
+ attrs = Hash[attrs.flat_map do |key, value|
62
+ if key == :data && value.is_a?(Hash)
63
+ value.map { |k, v| [:"data-#{k}", v] }
64
+ else
65
+ [[key, value]]
66
+ end
67
+ end]
68
+ end
69
+
58
70
  attrs.each do |key, value|
59
71
  if value.is_a?(Array)
60
72
  value = value.compact.join(" ")
@@ -107,7 +119,7 @@ module Tubby
107
119
  TAGS.each do |name|
108
120
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
109
121
  def #{name}(content = nil, **attrs, &blk)
110
- tag!(#{name.inspect}, content, attrs, &blk)
122
+ tag!(#{name.inspect}, content, **attrs, &blk)
111
123
  end
112
124
  RUBY
113
125
  end
@@ -115,7 +127,7 @@ module Tubby
115
127
  SELF_CLOSING_TAGS.each do |name|
116
128
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
117
129
  def #{name}(**attrs)
118
- self_closing_tag!(#{name.inspect}, attrs)
130
+ self_closing_tag!(#{name.inspect}, **attrs)
119
131
  end
120
132
  RUBY
121
133
  end
@@ -134,4 +146,3 @@ module Tubby
134
146
  end
135
147
  end
136
148
  end
137
-
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tubby
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus Holm
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-25 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email:
15
15
  - judofyr@gmail.com
16
16
  executables: []
@@ -23,9 +23,9 @@ files:
23
23
  - lib/tubby.rb
24
24
  homepage: https://github.com/judofyr/tubby
25
25
  licenses:
26
- - 0BSD
26
+ - BlueOak-1.0.0
27
27
  metadata: {}
28
- post_install_message:
28
+ post_install_message:
29
29
  rdoc_options: []
30
30
  require_paths:
31
31
  - lib
@@ -40,9 +40,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
- rubyforge_project:
44
- rubygems_version: 2.6.11
45
- signing_key:
43
+ rubygems_version: 3.0.3
44
+ signing_key:
46
45
  specification_version: 4
47
46
  summary: HTML templates as Ruby
48
47
  test_files: []