k_type 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/lib/k_type/composite.rb +53 -0
- data/lib/k_type/layered_folders.rb +1 -0
- data/lib/k_type/named_folders.rb +8 -0
- data/lib/k_type/version.rb +1 -1
- data/lib/k_type.rb +1 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81e12c5e1221f34c6932f756316be4cd448b485c864e00032fe1061796dd1b9f
|
4
|
+
data.tar.gz: d8219232da4b73d6fb4e475fad17aa883f32c559cd931d89c499c8aa9aa4d1e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbbb1b900d30e01b39c6df6fe72a8c37f4ebf009f707f24719adf2e955da32f70386b918d26ab65723ed43089eb4d805b2235f50e9646e84e77e99fece1237d8
|
7
|
+
data.tar.gz: 5097adb3642706db3f1b10317d2fc8c113b136f38ea39871689918c6d4219307ef86e2c9bf4db4b9e93f234d3c88301ec46d3f96c678b818b9aa3fd07aa8e494
|
data/Rakefile
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# TODO: future
|
4
|
+
# This pattern would be great as a configurable generic class
|
5
|
+
#
|
6
|
+
# children could be renamed as:
|
7
|
+
# - directors
|
8
|
+
# - components
|
9
|
+
# - elements
|
10
|
+
#
|
11
|
+
# It may also be relevant to separate parent form children
|
12
|
+
|
13
|
+
# Parent director allows upwards navigation
|
14
|
+
# attr_reader :parent
|
15
|
+
# Children directors allow downwards navigation plus access to sub-directors
|
16
|
+
# attr_reader :children
|
17
|
+
|
18
|
+
module KType
|
19
|
+
# Composite Design Pattern: https://refactoring.guru/design-patterns/composite
|
20
|
+
module Composite
|
21
|
+
# Parent allows upwards navigation to components
|
22
|
+
attr_reader :parent
|
23
|
+
|
24
|
+
# Children allow downwards navigation plus access to sub-components
|
25
|
+
attr_reader :children
|
26
|
+
|
27
|
+
def attach_parent(parent)
|
28
|
+
@parent = parent
|
29
|
+
end
|
30
|
+
|
31
|
+
def navigate_parent
|
32
|
+
parent.nil? ? self : parent
|
33
|
+
end
|
34
|
+
|
35
|
+
def root?
|
36
|
+
parent.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
# Implement as needed (Implement is not provided here because you may want to use hash or array and have additional logic)
|
40
|
+
# def reset_children
|
41
|
+
# end
|
42
|
+
# def add_child
|
43
|
+
# end
|
44
|
+
# def remove_child
|
45
|
+
# end
|
46
|
+
# def get_children
|
47
|
+
# end
|
48
|
+
# def has_child?
|
49
|
+
# end
|
50
|
+
# def execute
|
51
|
+
# end
|
52
|
+
end
|
53
|
+
end
|
data/lib/k_type/named_folders.rb
CHANGED
@@ -97,6 +97,10 @@ module KType
|
|
97
97
|
@folders.keys
|
98
98
|
end
|
99
99
|
|
100
|
+
def folder_paths
|
101
|
+
@folders.values
|
102
|
+
end
|
103
|
+
|
100
104
|
def to_h
|
101
105
|
@folders
|
102
106
|
end
|
@@ -104,10 +108,14 @@ module KType
|
|
104
108
|
def debug(title: 'named folders')
|
105
109
|
log.section_heading title
|
106
110
|
|
111
|
+
log.kv 'current', current
|
112
|
+
log.info ''
|
113
|
+
|
107
114
|
folders.each_key do |key|
|
108
115
|
folder = folders[key]
|
109
116
|
log.kv key.to_s, folder
|
110
117
|
end
|
118
|
+
nil
|
111
119
|
end
|
112
120
|
|
113
121
|
private
|
data/lib/k_type/version.rb
CHANGED
data/lib/k_type.rb
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'k_log'
|
4
4
|
require 'k_type/version'
|
5
|
+
require 'k_type/composite'
|
5
6
|
require 'k_type/named_folders'
|
6
7
|
require 'k_type/layered_folders'
|
7
8
|
|
8
9
|
module KType
|
9
10
|
# raise KType::Error, 'Sample message'
|
10
11
|
class Error < StandardError; end
|
11
|
-
|
12
|
-
# Your code goes here...
|
13
12
|
end
|
14
13
|
|
15
14
|
if ENV['KLUE_DEBUG']&.to_s&.downcase == 'true'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: k_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: k_log
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- hooks/update-version
|
53
53
|
- k_type.gemspec
|
54
54
|
- lib/k_type.rb
|
55
|
+
- lib/k_type/composite.rb
|
55
56
|
- lib/k_type/layered_folders.rb
|
56
57
|
- lib/k_type/named_folders.rb
|
57
58
|
- lib/k_type/version.rb
|
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
|
-
rubygems_version: 3.2.
|
81
|
+
rubygems_version: 3.2.33
|
81
82
|
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: K Type provides base types for KlueLess code generation
|