tailwind_dsl 0.0.8 → 0.0.10

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: e5d699a31b5861f307ea6f9d8b32c08435e2f33708977962d41c202010f8d106
4
- data.tar.gz: ee2aa1cc833cc840cb92d7f5e84d450d3709acb9507ca0b09b59fd54e898a4e5
3
+ metadata.gz: 40e1735a7ab823b626e62e1da89ee7987c50177c40b8f23a67a877225eb393d2
4
+ data.tar.gz: 511facb05203152eae4800af38aa2c0c7d209d9cd85e56a2efbedc37ade8e079
5
5
  SHA512:
6
- metadata.gz: bd7a34b8b6bd408db9bbe4c456cf5434842369ca96da813cf9ab13b78991f070e244362d905b94ae8a5c6f002bee00a63d43ce06fb12f946f4b07b80e4a3b309
7
- data.tar.gz: 9258ee349bd09aa3ecdc20be3300e2672e01a7024ae5cfe8bcc6bb15510a9301a8407f21272093ee8043657a475cec6d0a7ae836ee8b86caea5ed0fc7e176d3d
6
+ metadata.gz: 9833ddbabef4750b7c53ad17471d56e4f765bf59473e353ce27b44c214ac1cfa676ea2014b6f319f179539d11534b64338e7c36d5a841d165476cd84e1ebe140
7
+ data.tar.gz: 477cc658d824050f661946d046721153c3abd9bb554e0f015adf616a6b84306a1adad72b76dffe4b0aab962349bb5d31628fbfa7dddc7b5f884916f9ffd6ac83
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [0.0.9](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.8...v0.0.9) (2022-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add add_to_list to element ([acab18e](https://github.com/klueless-io/tailwind_dsl/commit/acab18e10e71624f549311eff0a8965411d87d66))
7
+
8
+ ## [0.0.8](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.7...v0.0.8) (2022-10-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add map_to to element ([216e93e](https://github.com/klueless-io/tailwind_dsl/commit/216e93ed8d1a59802132341b9501ee0921127061))
14
+
1
15
  ## [0.0.7](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.6...v0.0.7) (2022-10-13)
2
16
 
3
17
 
@@ -18,6 +18,10 @@ module TailwindDsl
18
18
  value || default
19
19
  end
20
20
 
21
+ # Map data to a class
22
+ #
23
+ # @param klass [Class] The class to map to
24
+ # @param data [Hash, Class] The data to map can be hash, an instance of the class or nil
21
25
  def map_to(klass, data)
22
26
  return nil if data.nil?
23
27
 
@@ -27,6 +31,20 @@ module TailwindDsl
27
31
  puts "Data of type: #{data.class} cannot be converted to #{klass}"
28
32
  nil
29
33
  end
34
+
35
+ # Add data onto an array
36
+ #
37
+ # @param target_list [Array] The array to add to
38
+ # @param data [Hash, Class] The data to add can be hash or an instance of the class. Nil data will not be added
39
+ def add_to_list(klass, target_list, data)
40
+ item = map_to(klass, data)
41
+
42
+ return nil if item.nil?
43
+
44
+ target_list << item
45
+
46
+ item
47
+ end
30
48
  end
31
49
  end
32
50
  end
@@ -18,13 +18,7 @@ module TailwindDsl
18
18
  end
19
19
 
20
20
  def add_group(group)
21
- add = map_to(Group, group)
22
-
23
- return nil if add.nil?
24
-
25
- groups << add
26
-
27
- add
21
+ add_to_list(Group, groups, group)
28
22
  end
29
23
 
30
24
  def to_h
@@ -18,17 +18,11 @@ module TailwindDsl
18
18
  @type = grab_arg(args, :type, guard: 'Missing type')
19
19
  @folder = grab_arg(args, :folder, guard: 'Missing folder')
20
20
  @sub_keys = grab_arg(args, :sub_keys, guard: 'Missing sub_keys')
21
- @files = grab_arg(args, :files, default: []).map { |file| convert_file(file) }.compact
21
+ @files = grab_arg(args, :files, default: []).map { |file| map_to(SourceFile, file) }.compact
22
22
  end
23
23
 
24
24
  def add_file(file)
25
- add = map_to(SourceFile, file)
26
-
27
- return nil if add.nil?
28
-
29
- files << add
30
-
31
- add
25
+ add_to_list(SourceFile, files, file)
32
26
  end
33
27
 
34
28
  def to_h
@@ -40,18 +34,6 @@ module TailwindDsl
40
34
  files: files.map(&:to_h)
41
35
  }
42
36
  end
43
-
44
- private
45
-
46
- def convert_file(file)
47
- return nil if file.nil?
48
-
49
- return file if file.is_a?(SourceFile)
50
- return SourceFile.new(**file) if file.is_a?(Hash)
51
-
52
- puts "Unknown file type: #{file.class}"
53
- nil
54
- end
55
37
  end
56
38
  end
57
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TailwindDsl
4
- VERSION = '0.0.8'
4
+ VERSION = '0.0.10'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tailwind_dsl",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tailwind_dsl",
9
- "version": "0.0.8",
9
+ "version": "0.0.10",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind_dsl",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Tailwind DSL will build tailwind websites useing Domain Specific Language conventions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailwind_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys