xrb 0.5.0 → 0.6.1

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: ad30d066b439b8ec2f61fa0e6ce50ac25dcc95ee7f4efe266382b15b486e1cd0
4
- data.tar.gz: 34d047c9ec0d9848f235e9e5becb7a9b33b25d3e5afdc6cfa097befc677f2b77
3
+ metadata.gz: fd37ae9601f70b0cfcbabe16d8fcb75979e9f1f3c31b09c09dc09e0778ecee62
4
+ data.tar.gz: 24fec49db14fee7d33279c8a1ebd886be3c260c094a40315525ca53c86e82421
5
5
  SHA512:
6
- metadata.gz: b56901d68f70088b2fe021c772af7b62bd4a6153f35780142ca9ea1203395faa3bce87ab6d678866fbdf2c0a0201db17f01c0a556ef45c6e3a1d3c118be62838
7
- data.tar.gz: efdfdaa9d81a87ee5d62e72a13169653fc13dade9ba555afbf2103c282c6f98792880599feda8de6aff0fc4cbe073ad3ceedc87bbf5cb5bbc2fb4966e7af6d0f
6
+ metadata.gz: 95f9e7530e0d5419c5a55a0a33d242f54fc15ac1f1e48d046c27b2b46d627e19b4fc7a90c111e428e502f58afe2a93818610758ecb757c31cc7990f2756f8220
7
+ data.tar.gz: 0fc975c1d6b59077b326efd428bb2f0039ead7198145c4b66aaab098fe0c58caaf0018c2568ea8fc0cab81b0f5346bd35df102eaac0ebe02e28ee7713ca020bd
checksums.yaml.gz.sig CHANGED
Binary file
Binary file
data/ext/markup.o CHANGED
Binary file
data/ext/query.o CHANGED
Binary file
data/ext/template.o CHANGED
Binary file
data/ext/xrb/escape.c CHANGED
@@ -159,8 +159,6 @@ VALUE XRB_Markup_escape_string(VALUE self, VALUE string) {
159
159
 
160
160
  void Init_XRB_escape(void) {
161
161
  rb_XRB_MarkupString = rb_define_class_under(rb_XRB, "MarkupString", rb_cString);
162
- rb_gc_register_mark_object(rb_XRB_MarkupString);
163
-
164
162
  rb_include_module(rb_XRB_MarkupString, rb_XRB_Markup);
165
163
 
166
164
  rb_undef_method(rb_class_of(rb_XRB_Markup), "escape_string");
data/ext/xrb/tag.c CHANGED
@@ -97,13 +97,18 @@ VALUE XRB_Tag_append_attributes(VALUE self, VALUE buffer, VALUE attributes, VALU
97
97
 
98
98
  for (i = 0; i < RARRAY_LEN(attributes); i++) {
99
99
  VALUE attribute = RARRAY_AREF(attributes, i);
100
+
101
+ if (rb_type(attribute) != T_ARRAY || RARRAY_LEN(attribute) != 2) {
102
+ rb_raise(rb_eTypeError, "expected array for attribute key/value pair");
103
+ }
104
+
100
105
  VALUE key = RARRAY_AREF(attribute, 0);
101
106
  VALUE value = RARRAY_AREF(attribute, 1);
102
107
 
103
108
  XRB_Tag_append_tag_attribute(buffer, key, value, prefix);
104
109
  }
105
110
  } else {
106
- rb_raise(rb_eArgError, "expected hash or array for attributes");
111
+ rb_raise(rb_eTypeError, "expected hash or array for attributes");
107
112
  }
108
113
 
109
114
  return Qnil;
data/ext/xrb/xrb.c CHANGED
@@ -50,13 +50,8 @@ void Init_XRB_Extension(void) {
50
50
  id_concat = rb_intern("<<");
51
51
 
52
52
  rb_XRB = rb_define_module("XRB");
53
- rb_gc_register_mark_object(rb_XRB);
54
-
55
53
  rb_XRB_Markup = rb_define_module_under(rb_XRB, "Markup");
56
- rb_gc_register_mark_object(rb_XRB_Markup);
57
-
58
54
  rb_XRB_Native = rb_define_module_under(rb_XRB, "Native");
59
- rb_gc_register_mark_object(rb_XRB_Native);
60
55
 
61
56
  Init_XRB_escape();
62
57
 
data/lib/xrb/markup.rb CHANGED
@@ -46,6 +46,12 @@ module XRB
46
46
  def self.raw(string)
47
47
  self.new(string, false)
48
48
  end
49
+
50
+ # This "string" is already escaped, thus it is safe to append to the output buffer.
51
+ # This predicate is used by Rails' `ActionView::OutputBuffer` to determine if the string should be escaped or not.
52
+ def html_safe?
53
+ true
54
+ end
49
55
  end
50
56
 
51
57
  module Script
data/lib/xrb/tag.rb CHANGED
@@ -99,7 +99,11 @@ module XRB
99
99
  when Hash
100
100
  self.append_attributes(buffer, value, attribute_key)
101
101
  when Array
102
- self.append_attributes(buffer, value, attribute_key)
102
+ value.each do |attribute|
103
+ raise TypeError, "expected array of key-value pairs" unless attribute.is_a?(Array) and attribute.size == 2
104
+
105
+ self.append_attributes(buffer, [attribute], attribute_key)
106
+ end
103
107
  when TrueClass
104
108
  buffer << ' ' << attribute_key.to_s
105
109
  else
data/lib/xrb/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2012-2024, by Samuel Williams.
5
5
 
6
6
  module XRB
7
- VERSION = "0.5.0"
7
+ VERSION = "0.6.1"
8
8
  end
data/license.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Copyright, 2012-2024, by Samuel Williams.
4
4
  Copyright, 2020, by Cyril Roelandt.
5
5
  Copyright, 2022, by Adam Daniels.
6
+ Copyright, 2024, by Jean Boussier.
6
7
 
7
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
9
  of this software and associated documentation files (the "Software"), to deal
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  - Adam Daniels
9
9
  - Cyril Roelandt
10
+ - Jean Boussier
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain:
@@ -39,7 +40,7 @@ cert_chain:
39
40
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
40
41
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
41
42
  -----END CERTIFICATE-----
42
- date: 2024-04-28 00:00:00.000000000 Z
43
+ date: 2024-05-06 00:00:00.000000000 Z
43
44
  dependencies: []
44
45
  description:
45
46
  email:
metadata.gz.sig CHANGED
Binary file