squared 0.5.12 → 0.6.0

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.
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Squared
4
+ module Workspace
5
+ module Support
6
+ module Variables
7
+ private
8
+
9
+ def hashobj
10
+ Hash.new { |data, key| data[key] = {} }
11
+ end
12
+
13
+ def hashlist
14
+ Hash.new { |data, key| data[key] = [] }
15
+ end
16
+
17
+ def hashdup(data, compact: false, freeze: false, target: {}, pass: {})
18
+ data.each do |key, val|
19
+ next if val.nil? && compact
20
+
21
+ target[key] = case val
22
+ when Hash
23
+ if pass.key?(val)
24
+ pass[val]
25
+ else
26
+ hashdup(val, compact: compact, freeze: freeze, target: pass[val] = {}, pass: pass)
27
+ end
28
+ when Enumerable
29
+ compact ? val.compact : val.dup
30
+ when Proc, Method
31
+ val
32
+ else
33
+ val.dup
34
+ end
35
+ target[key].freeze if freeze && val.frozen?
36
+ end
37
+ target
38
+ end
39
+ end
40
+
41
+ class << Support
42
+ include Variables
43
+
44
+ public(*Variables.private_instance_methods(false))
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'support/base'
4
- require_relative 'support/data'
4
+ require_relative 'support/variables'
@@ -6,7 +6,7 @@ module Squared
6
6
  include Common
7
7
 
8
8
  def resolve(*args)
9
- ret = args.map do |id|
9
+ ret = args.map! do |id|
10
10
  if id.is_a?(Symbol)
11
11
  project id
12
12
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -101,7 +101,7 @@ files:
101
101
  - lib/squared/workspace/series.rb
102
102
  - lib/squared/workspace/support.rb
103
103
  - lib/squared/workspace/support/base.rb
104
- - lib/squared/workspace/support/data.rb
104
+ - lib/squared/workspace/support/variables.rb
105
105
  - squared.gemspec
106
106
  homepage: https://github.com/anpham6/squared-ruby
107
107
  licenses:
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Squared
4
- module Workspace
5
- module Support
6
- RunData = Struct.new('RunData', :run, :block)
7
- ChainData = Struct.new('ChainData', :action, :step, :with, :before, :after, :sync)
8
- BannerData = Struct.new('BannerData', :command, :order, :styles, :border)
9
- end
10
- end
11
- end