ruby-tags 0.1.0 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 479c8738d0cf378f4c0c76a5b172c882995f9c12d12506db926dc7a9bf4e1c3f
4
- data.tar.gz: 207a5d848f10ab35ed1eda33b7d7a86670d0aa3eadef7146cf61da884ae79cb5
3
+ metadata.gz: 5235987a8b3502115dea45813c0950bf5c3172ef3fe6ca97c2c5e2adfa6f75fd
4
+ data.tar.gz: ba081fa62df4aba26a0c8a5f2f070b35436fb52adbe13df308ef144cba95acdd
5
5
  SHA512:
6
- metadata.gz: ff83e2d0e019fed08d8681e4cac4bbba10424bc228c0fc6fc5735b25010e6d4ffd75388a2dbf20258b95b4f549a86ebfc796fc14a76401f55c1cf6cbdf1f5daa
7
- data.tar.gz: d9b30a0343d4411f732f295aa8eaff5e4942d98ea1fdb5ff5ad1109d5e4c06621782dbb9b3acd6ef1d02e5f188d40d2fde0d2229752fdc90dfd775566bec094e
6
+ metadata.gz: f79d952b06e11dc2f540bfc949b472ead5234084567ba876e85d8417d949df6e95aba65df35d7a32e3b8113795020b723f9545a9fc739960288ae8d393fc4740
7
+ data.tar.gz: 3932246fc5fc04afd676c682ab3b9382673ea6b16d6a740f180eb0a379ce711c8ceede55193025e743616ea11d481c0e36c2d9a353a50434e95075f8bfacbd07
@@ -2,10 +2,6 @@ module Ruby
2
2
  module Tags
3
3
  class Attribute
4
4
 
5
- def self.blank?(s)
6
- s.nil? || s.to_s.strip.empty? || s.empty?
7
- end
8
-
9
5
  def initialize(attributes = {})
10
6
  @attributes = attributes.to_h { |k,v| [k, v.to_s.split] }
11
7
  end
@@ -37,7 +33,7 @@ module Ruby
37
33
  end
38
34
 
39
35
  def render
40
- @attributes.reject{ |k,v| [k,v].any? { |x| Attribute.blank? x } }
36
+ @attributes.reject{ |k,v| [k,v].any? { |x| blank? x } }
41
37
  .reduce(@attributes.empty? && "" || " ") { |m, (k, a)| "#{m}#{k}='#{sanitize(a)}' " }
42
38
  .delete_suffix(" ")
43
39
  end
@@ -64,6 +60,10 @@ module Ruby
64
60
  def sanitize(s)
65
61
  s.join(" ").gsub(/'/,"'").strip
66
62
  end
63
+
64
+ def blank?(s)
65
+ s.nil? || s.to_s.strip.empty? || s.empty?
66
+ end
67
67
  end
68
68
  end
69
69
  end
@@ -14,6 +14,10 @@ module Ruby
14
14
  Text.new string
15
15
  end
16
16
 
17
+ def group(*tags)
18
+ Group.new *tags
19
+ end
20
+
17
21
  # Void html elements. W3C [reference](https://www.w3.org/TR/2011/WD-html-markup-20110405/syntax.html#syntax-elements)
18
22
  #
19
23
  # Example:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - manlioGit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-04 00:00:00.000000000 Z
11
+ date: 2021-03-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: