objective_elements 1.1.1 → 1.1.2

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: 4e2d1f8b25c51909941b93851d03b35750d6f565a96c79e15c4fc7b335c8569b
4
- data.tar.gz: cfc29825193a34c5d5fe1c6aa279cd2d5767181639afa1080eba7faad0081091
3
+ metadata.gz: d19b11b8215023de5a6dc505034de4d08e02e1beca92c20b6920a6ad6420a09e
4
+ data.tar.gz: c24f570c8e46ca9609c46e2ad70d309d5a170a6c2c8da0ec2932e76efaba7a71
5
5
  SHA512:
6
- metadata.gz: 35c68f9a39dbe6da0ab4ff7681bff27ec230a1633c0d991c7015bd359225cd92b7d6b9ed02a1e5563a9a2675953e715ec55b851c62c59e4a61185ab7188f459a
7
- data.tar.gz: a6fb2881ad600bde01391a56359a3a35459d957e561cc9b5c0cdd20bfe66b1028c6c636d7711bff67b89a6321a39230b6ed9ce18578898aa26d5449f3c55fbcb
6
+ metadata.gz: 97bf3bd7f4c6cf88c6441a5bcb3098735e90c135abbe14ea940012b81f5bd98a7a4a468492e6b897ee680e0656df3daf5485acf122daacdc656b653a8d56c020
7
+ data.tar.gz: 7f0710dbea4c75c73290c5818922cb7004649f87ea566053ad49d365ff3499267cdd87b2aa3071082129d2b5827aa9cd6bee76b4bc179175c43d2548d2f17127
@@ -0,0 +1,2 @@
1
+ Style/FrozenStringLiteralComment:
2
+ Enabled: false
@@ -0,0 +1,15 @@
1
+ ---
2
+ include:
3
+ - "**/*.rb"
4
+ exclude:
5
+ - spec/**/*
6
+ - test/**/*
7
+ - vendor/**/*
8
+ - ".bundle/**/*"
9
+ require: []
10
+ domains: []
11
+ reporters:
12
+ - rubocop
13
+ - require_not_found
14
+ require_paths: []
15
+ max_files: 5000
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in elements.gemspec
6
6
  gemspec
@@ -1,31 +1,72 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- objective_elements (1.1.0)
4
+ objective_elements (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ ast (2.4.0)
10
+ backport (1.1.2)
11
+ benchmark (0.1.0)
9
12
  coderay (1.1.2)
10
13
  diff-lcs (1.3)
11
- method_source (0.9.0)
14
+ e2mmap (0.1.0)
15
+ jaro_winkler (1.5.4)
16
+ maruku (0.7.3)
17
+ method_source (0.9.2)
18
+ mini_portile2 (2.4.0)
19
+ nokogiri (1.10.7)
20
+ mini_portile2 (~> 2.4.0)
21
+ parallel (1.19.1)
22
+ parser (2.7.0.2)
23
+ ast (~> 2.4.0)
12
24
  pry (0.11.3)
13
25
  coderay (~> 1.1.0)
14
26
  method_source (~> 0.9.0)
27
+ rainbow (3.0.0)
15
28
  rake (10.5.0)
29
+ reverse_markdown (1.4.0)
30
+ nokogiri
16
31
  rspec (3.8.0)
17
32
  rspec-core (~> 3.8.0)
18
33
  rspec-expectations (~> 3.8.0)
19
34
  rspec-mocks (~> 3.8.0)
20
- rspec-core (3.8.0)
35
+ rspec-core (3.8.2)
21
36
  rspec-support (~> 3.8.0)
22
- rspec-expectations (3.8.1)
37
+ rspec-expectations (3.8.6)
23
38
  diff-lcs (>= 1.2.0, < 2.0)
24
39
  rspec-support (~> 3.8.0)
25
- rspec-mocks (3.8.0)
40
+ rspec-mocks (3.8.2)
26
41
  diff-lcs (>= 1.2.0, < 2.0)
27
42
  rspec-support (~> 3.8.0)
28
- rspec-support (3.8.0)
43
+ rspec-support (3.8.3)
44
+ rubocop (0.79.0)
45
+ jaro_winkler (~> 1.5.1)
46
+ parallel (~> 1.10)
47
+ parser (>= 2.7.0.1)
48
+ rainbow (>= 2.2.2, < 4.0)
49
+ ruby-progressbar (~> 1.7)
50
+ unicode-display_width (>= 1.4.0, < 1.7)
51
+ ruby-progressbar (1.10.1)
52
+ solargraph (0.38.2)
53
+ backport (~> 1.1)
54
+ benchmark
55
+ bundler (>= 1.17.2)
56
+ e2mmap
57
+ jaro_winkler (~> 1.5)
58
+ maruku (~> 0.7, >= 0.7.3)
59
+ nokogiri (~> 1.9, >= 1.9.1)
60
+ parser (~> 2.3)
61
+ reverse_markdown (~> 1.0, >= 1.0.5)
62
+ rubocop (~> 0.52)
63
+ thor (~> 1.0)
64
+ tilt (~> 2.0)
65
+ yard (~> 0.9)
66
+ thor (1.0.1)
67
+ tilt (2.0.10)
68
+ unicode-display_width (1.6.0)
69
+ yard (0.9.24)
29
70
 
30
71
  PLATFORMS
31
72
  ruby
@@ -36,6 +77,8 @@ DEPENDENCIES
36
77
  pry (~> 0.11.3)
37
78
  rake (~> 10.0)
38
79
  rspec (~> 3.8.0)
80
+ rubocop (~> 0.79)
81
+ solargraph (~> 0.38)
39
82
 
40
83
  BUNDLED WITH
41
84
  1.17.2
data/README.md CHANGED
@@ -18,7 +18,7 @@ you only need sometimes, it turns into a horrible mess.
18
18
 
19
19
  The problem, of course, is that building long, complex, varying blocks of text with string
20
20
  concatenation and interpolation is fragile, unreadable, and painful. You know this, but you're not
21
- going to write an entirely new class or pull in some big new dependency just for 10 lines of HTML,
21
+ going to write an entirely new class or pull in some big new dependency just for 10 lines of HTML,
22
22
  so instead you hammer through it and end up with code like this:
23
23
 
24
24
  ```ruby
@@ -29,7 +29,8 @@ picture_tag = "<picture>\n"\
29
29
  "#{html_attr_string}>\n"\"#{markdown_escape * 2}</picture>\n"
30
30
  ```
31
31
 
32
- or this:
32
+ or this:
33
+
33
34
  ```ruby
34
35
  def build_li(this_item_data, icon_location, label)
35
36
  li = " <li#{@attributes['li']}>"
@@ -98,43 +99,50 @@ div = p.add_parent DoubleTag.new 'div'
98
99
 
99
100
  ## Changes
100
101
 
102
+ ### 1.1.1
103
+
104
+ Fix bug where duplicate attribute keys would overwrite each other's values, when passed at the same time.
105
+
101
106
  ### 1.1.0
107
+
102
108
  Add `ShelfTag`, which is useful when you want to create siblings without a parent element.
103
109
 
104
110
  ### 1.0.0
105
- Attributes syntax has changed pretty significantly. Find `.add_attributes` & replace `.attributes << `
111
+
112
+ Attributes syntax has changed pretty significantly. Find `.add_attributes` & replace `.attributes <<`
106
113
  will get you most of the way there, but you should read over the usage section again.
107
114
 
108
115
  ## Installation
109
116
 
110
- ```ruby
111
- # Gemfile
112
-
113
- gem 'objective_elements', '~> 1.0.0'
114
- ```
115
-
116
- ```ruby
117
- # Anywhere else:
118
-
119
- require 'objective_elements'
120
- ```
121
-
117
+ ```ruby
118
+ # Gemfile
119
+
120
+ gem 'objective_elements', '~> 1.0.0'
121
+ ```
122
+
123
+ ```ruby
124
+ # Anywhere else:
125
+
126
+ require 'objective_elements'
127
+ ```
128
+
122
129
  ## Terminology
123
130
 
124
131
  ```
125
132
  <p class="stumpy">Hello</p>
126
133
  |a| b | c | d |
127
134
  ```
128
- - a - element
129
- - b - attributes
130
- - a+b - opening tag
131
- - c - content
132
- - d - closing tag
133
135
 
136
+ - a - element
137
+ - b - attributes
138
+ - a+b - opening tag
139
+ - c - content
140
+ - d - closing tag
134
141
 
135
142
  ## Usage
136
143
 
137
144
  For Attribute & SingleTag examples, we'll use this image tag:
145
+
138
146
  ```ruby
139
147
 
140
148
  img = SingleTag.new 'img', attributes: 'src="angry-baby.jpg"'
@@ -146,34 +154,39 @@ A `SingleTag` is a self-closing tag, meaning it has no content and no closing ta
146
154
  the other kind.
147
155
 
148
156
  ### Attributes
157
+
149
158
  Attributes are their own class, and can be accessed by the `.attributes` method on both single and
150
159
  double tags. Important methods:
151
160
 
152
- ` << (attribute)`
161
+ `<< (attribute)`
162
+
153
163
  - Example: `p.attributes << 'alt="he does not look happy"'`
154
164
  - Example: `p.attributes << { alt: "he does not look happy" }`
155
165
  - Add new attributes, can accept a hash or a string. Hash keys will be converted
156
- to symbols if they are not already, and values will be split on spaces into an array if they are not
157
- already. Attributes can also be given as a string in the standard HTML syntax (`class="myclass"
158
- id="my-id"`). **Every other method which adds attributes in some way, calls this method**. This
159
- means that any time you are adding attributes, you can use any format which this method understands.
160
-
161
- `.delete(attribute)`
166
+ to symbols if they are not already, and values will be split on spaces into an array if they are not
167
+ already. Attributes can also be given as a string in the standard HTML syntax (`class="myclass" id="my-id"`). **Every other method which adds attributes in some way, calls this method**. This
168
+ means that any time you are adding attributes, you can use any format which this method understands.
169
+
170
+ `.delete(attribute)`
171
+
162
172
  - Example: `img.attributes.delete 'src'`
163
173
  - Example: `img.attributes.delete :src`
164
174
  - Example: `img.attributes.delete [:src, 'alt']`
165
175
  - Delete one or more attributes. Accepts a string, symbol, or an array of
166
- strings and/or symbols.
176
+ strings and/or symbols.
177
+
178
+ `.replace(attribute)`
167
179
 
168
- `.replace(attribute)`
169
180
  - Example: `img.attributes.replace 'src="happy-baby.jpg"'`
170
181
  - Replaces one or more attributes and values individually.
171
182
 
172
- `.content[:attribute_name] = `
183
+ `.content[:attribute_name] =`
184
+
173
185
  - Example: `img.attributes.content[:src] = 'dirty-baby.jpg'` < This just broke everything.
174
- - Don't do it. Use `.replace`, `.(attribute name) = `, or `<<`
186
+ - Don't do it. Use `.replace`, `.(attribute name) =`, or `<<`
187
+
188
+ `.content[:attribute_name]`
175
189
 
176
- `.content[:attribute_name]`
177
190
  - Example: `img.attributes[:src] # returns 'angry-baby.jpg`
178
191
  - Retrieve the content for a given attribute, as an array of strings. Must be a symbol. You'll
179
192
  - mostly need this when you don't know which attribute you need ahead of
@@ -181,18 +194,20 @@ strings and/or symbols.
181
194
 
182
195
  **There is a shorthand for the next two methods. Keep reading.**
183
196
 
184
- `.(attribute_name)`
197
+ `.(attribute_name)`
198
+
185
199
  - Example: `img.attributes.src # 'angry-baby.jpg'`
186
200
  - Convenience method/syntactic sugar: Returns the value of a given attribute name, as a
187
201
  - space-separated string. This relies on method_missing, which means that any overlap with
188
- already existing methods won't work.
202
+ already existing methods won't work.
189
203
  - **You can't access `class` or `method` html attributes this way, because
190
204
  basic objects in ruby already have those methods.**
191
205
  - **Ruby methods can't have dashes in them.** This means `p.data-awesomeness` won't work.
192
206
 
193
- `.(attribute_name) = value`
207
+ `.(attribute_name) = value`
208
+
194
209
  - Example: `img.attributes.src = 'happy-baby.jpg'`
195
- - Same as above. Similar to `.replace(attribute)`. Interestingly, `method = ` and `class = ` both
210
+ - Same as above. Similar to `.replace(attribute)`. Interestingly, `method =` and `class =` both
196
211
  work (`.class` is defined on the basic object class, but `.class=` is not.). Still, you
197
212
  probably shouldn't use them.
198
213
 
@@ -203,36 +218,43 @@ strings and/or symbols.
203
218
 
204
219
  ### SingleTag Properties:
205
220
 
206
- #### element
207
- - String
208
- - Mandatory
209
- - Which type of tag, such as 'hr' or 'img'
210
-
211
- #### attributes
212
- - Instance of the class described above.
221
+ #### element
222
+
223
+ - String
224
+ - Mandatory
225
+ - Which type of tag, such as 'hr' or 'img'
226
+
227
+ #### attributes
228
+
229
+ - Instance of the class described above.
213
230
 
214
231
  ### SingleTag Methods (that you care about)
215
232
 
216
233
  `SingleTag.new(element, attributes: nil)`
217
234
 
218
- `.to_s`
235
+ `.to_s`
236
+
219
237
  - Example: `img.to_s`
220
238
  - The big one. Returns your HTML as a string, nondestructively.
221
239
 
222
- `.add_parent(DoubleTag)`
240
+ `.add_parent(DoubleTag)`
241
+
223
242
  - Example: `img.add_parent DoubleTag.new 'picture'`
224
243
  - returns supplied DoubleTag, with self added as a child.
225
244
 
226
- `.attributes`
245
+ `.attributes`
246
+
227
247
  - Example: `img.attributes`
228
248
  - attr_reader for HTML attributes. This is how you can access any attribute method
229
- described above.
249
+ described above.
250
+
251
+ `.reset_attributes`
230
252
 
231
- `.reset_attributes`
232
253
  - Example: `img.reset_attributes`
233
254
  - Removes all attributes.
234
255
 
235
- `.attributes=(new)`
256
+ `.attributes=(new)`
257
+
236
258
  - Example: `img.attributes = 'src="grumpy-baby.jpg" id="muddy"'`
237
259
  - Equivalent to `reset_attributes` and `.attributes << new`
238
260
 
@@ -241,40 +263,43 @@ described above.
241
263
 
242
264
  ### DoubleTag Properties:
243
265
 
244
-
245
266
  #### `DoubleTag` Inherits all of `SingleTag`'s properties and methods, and adds content and a
267
+
246
268
  closing tag.
247
269
 
248
- #### content
270
+ #### content
249
271
 
250
- - Array
251
- - Optional
252
- - Contains anything (but probably just strings and tags. Anything else will be turned into a
253
- string with `.to_s`, which is an alias for `.inspect` most of the time).
254
- - Each element in the array corresponds to at least one line of HTML
255
- - Multiline child tags will get as many lines as they need (like you'd expect).
256
- - Child elements are not rendered until the parent is rendered, meaning you can access and
257
- modify them after defining a parent.
258
- - add with `.add_content`, or modify the content array directly.
272
+ - Array
273
+ - Optional
274
+ - Contains anything (but probably just strings and tags. Anything else will be turned into a
275
+ string with `.to_s`, which is an alias for `.inspect` most of the time).
276
+ - Each element in the array corresponds to at least one line of HTML
277
+ - Multiline child tags will get as many lines as they need (like you'd expect).
278
+ - Child elements are not rendered until the parent is rendered, meaning you can access and
279
+ modify them after defining a parent.
280
+ - add with `.add_content`, or modify the content array directly.
259
281
 
260
- #### oneline
261
- - Boolean
262
- - optional, defaults to false.
263
- - When true, the entire element and its content will be rendered as a single line. Useful for
264
- anchor tags and list items.
282
+ #### oneline
283
+
284
+ - Boolean
285
+ - optional, defaults to false.
286
+ - When true, the entire element and its content will be rendered as a single line. Useful for
287
+ anchor tags and list items.
265
288
 
266
289
  ### DoubleTag Methods (that you care about)
267
290
 
268
- For DoubleTag Examples, we're working with a div tag:
291
+ For DoubleTag Examples, we're working with a div tag:
269
292
 
270
293
  ```
271
294
  div = DoubleTag.new 'div'
272
295
  ```
273
296
 
274
- `DoubleTag.new(element, attributes: {}, oneline: false, content: [])`
297
+ `DoubleTag.new(element, attributes: {}, oneline: false, content: [])`
298
+
275
299
  - You can initialize it with content.
276
300
 
277
- `add_content(anything)`
301
+ `add_content(anything)`
302
+
278
303
  - Example: `div.add_content 'example text!'`
279
304
  - Example: `div.add_content ['splits', 'across', 'lines']`
280
305
  - Example: `div.add_content img # image tag from earlier`
@@ -300,77 +325,78 @@ tag.
300
325
  Convert it into an actual tag with `.add_parent(DoubleTag)`
301
326
 
302
327
  ## Configuration
303
-
304
- Indentation is defined by the `indent` method on the DoubleTag class, which is two escaped
305
- spaces by default ("\ \ "). If you'd like to change it:
306
328
 
307
- 1. Make a new class, inherit from DoubleTag.
308
- 2. Override `indent` with whatever you want.
309
- 3. Use your new class instead of DoubleTag.
329
+ Indentation is defined by the `indent` method on the DoubleTag class, which is two escaped
330
+ spaces by default ("\ \ "). If you'd like to change it:
331
+
332
+ 1. Make a new class, inherit from DoubleTag.
333
+ 2. Override `indent` with whatever you want.
334
+ 3. Use your new class instead of DoubleTag.
335
+
336
+ Example:
310
337
 
311
- Example:
338
+ ```ruby
312
339
 
313
- ```ruby
314
-
315
- require 'objective_elements'
340
+ require 'objective_elements'
316
341
 
317
- class MyDoubleTag < DoubleTag
318
- def indent
319
- # 4 escaped spaces:
320
- "\ \ \ \ "
321
- end
342
+ class MyDoubleTag < DoubleTag
343
+ def indent
344
+ # 4 escaped spaces:
345
+ "\ \ \ \ "
322
346
  end
347
+ end
323
348
 
324
349
  MyDoubleTag.new('p', content: 'hello').to_s
325
350
  # <p>
326
351
  # hello
327
352
  # </p>
328
353
 
329
- ```
330
-
331
- ## Limitations
332
-
333
- * It doesn't know a single HTML element on its own, so it does nothing to ensure your HTML is valid.
334
-
335
- * A parent tag can't put siblings on the same line. You can either do this (with `oneline: true` on
336
- the strong tag):
354
+ ```
337
355
 
338
- ```html
356
+ ## Limitations
339
357
 
340
- <p>
341
- Here is some
342
- <strong>strong</strong>
343
- text.
344
- </p>
358
+ - It doesn't know a single HTML element on its own, so it does nothing to ensure your HTML is valid.
345
359
 
346
- ```
347
- or this (default behavior):
360
+ - A parent tag can't put siblings on the same line. You can either do this (with `oneline: true` on
361
+ the strong tag):
348
362
 
349
- ```html
363
+ ```html
364
+ <p>
365
+ Here is some
366
+ <strong>strong</strong>
367
+ text.
368
+ </p>
369
+ ```
350
370
 
351
- <p>
352
- Here is some
353
- <strong>
354
- strong
355
- </strong>
356
- text.
357
- </p>
371
+ or this (default behavior):
358
372
 
359
- ```
360
- But you can't do this without string interpolation or something:
373
+ ```html
374
+ <p>
375
+ Here is some
376
+ <strong>
377
+ strong
378
+ </strong>
379
+ text.
380
+ </p>
381
+ ```
361
382
 
362
- ```html
383
+ But you can't do this without string interpolation or something:
363
384
 
364
- <p>Here is some <strong>strong</strong> text.</p>
385
+ ```html
386
+ <p>
387
+ Here is some
388
+ <strong>strong</strong>
389
+ text.
390
+ </p>
391
+ ```
365
392
 
366
- ```
367
- This doesn't affect how the browser will render it, but it might bug you if you're particular about
368
- source code layout.
393
+ This doesn't affect how the browser will render it, but it might bug you if you're particular about
394
+ source code layout.
369
395
 
370
- * If you set 'oneline: true' on a parent DoubleTag, but not all its children DoubleTags, the output
396
+ - If you set 'oneline: true' on a parent DoubleTag, but not all its children DoubleTags, the output
371
397
  will not be pretty. I advise against it. Handling this situation is on the TODO list.
372
398
 
373
- * It doesn't wrap long lines of text, and it doesn't indent text with newlines embedded. It's on the
399
+ - It doesn't wrap long lines of text, and it doesn't indent text with newlines embedded. It's on the
374
400
  TODO list.
375
401
 
376
402
  ## Contributing
data/Rakefile CHANGED
@@ -1,2 +1,8 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ require 'bundler/gem_tasks'
2
+ require 'rubocop/rake_task'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RuboCop::RakeTask.new
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: %i[spec rubocop]
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "elements"
3
+ require 'bundler/setup'
4
+ require 'elements'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "elements"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -1,3 +1,8 @@
1
+ # Author: Robert Buchberger <robert@buchberger.cc>
2
+ #
3
+ # This module provides a few helpful classes for generating HTML using simple
4
+ # Ruby. Its goal is to be lightweight, and more focused than the general-purpose
5
+ # nature of nokogiri.
1
6
  module ObjectiveElements
2
7
  require_relative 'objective_elements/single_tag'
3
8
  require_relative 'objective_elements/double_tag'
@@ -13,6 +13,10 @@ class HTMLAttributes
13
13
  def to_s
14
14
  return_string = ''
15
15
  @content.each_pair do |k, v|
16
+ # If an attribute has no values, we need to introduce an empty string to
17
+ # the array in order to get the correct format (alt="", for example):
18
+ v << '' if v.empty?
19
+
16
20
  return_string << "#{k}=\"#{v.join ' '}\" "
17
21
  end
18
22
 
@@ -86,27 +90,34 @@ class HTMLAttributes
86
90
  add_hash hashify_input new_string
87
91
  end
88
92
 
89
- def add_hash(new)
93
+ # Input: Keys are attribute names (either strings or symbols), values are
94
+ # attribute values (either a string or an array of strings)
95
+ def add_hash(new_hash)
90
96
  formatted_new = {}
91
- new.each_pair do |k, v|
92
- v = v.split ' ' if v.is_a? String
97
+
98
+ new_hash.each_pair do |k, v|
99
+ v = v.split(' ') if v.is_a? String
100
+
93
101
  formatted_new[k.to_sym] = v
94
102
  end
95
103
 
96
- @content.merge! formatted_new do |_key, oldval, newval|
97
- oldval.concat newval
104
+ @content.merge!(formatted_new) do |_key, oldval, newval|
105
+ oldval.concat(newval)
98
106
  end
107
+
99
108
  self
100
109
  end
101
110
 
102
111
  def hashify_input(new_string)
103
112
  # looking for something like:
104
- # 'class="something something-else" id="my-id"'
113
+ # 'class="something something-else" id="my-id" alt=""'
105
114
  new_hash = {}
106
- new_string.scan(/ ?([^="]+)="([^"]+)"/).each do |m|
107
- # [['class','something something-else'],['id','my-id']]
108
- key = m.shift
109
- val = m.pop
115
+ new_string.scan(/ ?([^="]+)="([^"]*)"/).each do |match|
116
+ # Returns something like:
117
+ # [['class','something something-else'],['id','my-id'],['alt', '']]
118
+
119
+ key, val = *match
120
+
110
121
  if new_hash[key]
111
122
  new_hash[key] << ' ' + val
112
123
  else
@@ -1,3 +1,3 @@
1
1
  module ObjectiveElements
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.1.2'.freeze
3
3
  end
@@ -6,9 +6,9 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'objective_elements'
7
7
  spec.version = ObjectiveElements::VERSION
8
8
  spec.authors = ['Robert Buchberger']
9
- spec.email = ['robert@robert-buchberger.com']
9
+ spec.email = ['robert@buchberger.cc']
10
10
 
11
- spec.summary = 'Build HTML without interpolating strings.'
11
+ spec.summary = 'Build HTML with simple ruby.'
12
12
  spec.homepage = 'https://github.com/rbuchberger/objective_elements'
13
13
  spec.license = 'MIT'
14
14
 
@@ -28,4 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency 'pry', '~>0.11.3'
29
29
  spec.add_development_dependency 'rake', '~> 10.0'
30
30
  spec.add_development_dependency 'rspec', '~>3.8.0'
31
+ spec.add_development_dependency 'rubocop', '~>0.79'
32
+ spec.add_development_dependency 'solargraph', '~>0.38'
31
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: objective_elements
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Buchberger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-14 00:00:00.000000000 Z
11
+ date: 2020-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,14 +66,44 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.8.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.79'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.79'
83
+ - !ruby/object:Gem::Dependency
84
+ name: solargraph
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.38'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.38'
69
97
  description:
70
98
  email:
71
- - robert@robert-buchberger.com
99
+ - robert@buchberger.cc
72
100
  executables: []
73
101
  extensions: []
74
102
  extra_rdoc_files: []
75
103
  files:
76
104
  - ".gitignore"
105
+ - ".rubocop.yml"
106
+ - ".solargraph.yml"
77
107
  - Gemfile
78
108
  - Gemfile.lock
79
109
  - LICENSE.txt
@@ -110,5 +140,5 @@ requirements: []
110
140
  rubygems_version: 3.0.3
111
141
  signing_key:
112
142
  specification_version: 4
113
- summary: Build HTML without interpolating strings.
143
+ summary: Build HTML with simple ruby.
114
144
  test_files: []