tailwind_dsl 0.0.8 → 0.0.9

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: e5d699a31b5861f307ea6f9d8b32c08435e2f33708977962d41c202010f8d106
4
- data.tar.gz: ee2aa1cc833cc840cb92d7f5e84d450d3709acb9507ca0b09b59fd54e898a4e5
3
+ metadata.gz: 5dd15ed9d68116ddac73f9db7a46ed21a0b4b39eebf9d44116533a38bbb82de4
4
+ data.tar.gz: 77891a8ce328c52a31026b5166c5c8b36bbd49d8d92bfbb45cfe5f71ed18f307
5
5
  SHA512:
6
- metadata.gz: bd7a34b8b6bd408db9bbe4c456cf5434842369ca96da813cf9ab13b78991f070e244362d905b94ae8a5c6f002bee00a63d43ce06fb12f946f4b07b80e4a3b309
7
- data.tar.gz: 9258ee349bd09aa3ecdc20be3300e2672e01a7024ae5cfe8bcc6bb15510a9301a8407f21272093ee8043657a475cec6d0a7ae836ee8b86caea5ed0fc7e176d3d
6
+ metadata.gz: 5d7a1963927ef33b364afd4a66d5edf1d49302998406a75f70ed92265e7dc2e85bce394394707b8fac09fec456bb26a8f8e1a89970ba80d0824b8c7fc417b860
7
+ data.tar.gz: 30875df7abaf8519fdf7daa294a1eb81bc2721ad053a6e164965438b2c3211853bfcfe8bf054a2d419bcd80a41ee98e397c23e0af188dafb179d32205fd0c3e2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.0.8](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.7...v0.0.8) (2022-10-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add map_to to element ([216e93e](https://github.com/klueless-io/tailwind_dsl/commit/216e93ed8d1a59802132341b9501ee0921127061))
7
+
1
8
  ## [0.0.7](https://github.com/klueless-io/tailwind_dsl/compare/v0.0.6...v0.0.7) (2022-10-13)
2
9
 
3
10
 
@@ -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.9'
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.9",
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.9",
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.9",
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.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys