coral_core 0.2.26 → 0.2.30
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.
- data/Gemfile +7 -2
- data/Gemfile.lock +84 -15
- data/VERSION +1 -1
- data/coral_core.gemspec +51 -16
- data/lib/{coral_core/command.rb → coral/command/shell.rb} +12 -116
- data/lib/coral/machine/fog.rb +215 -0
- data/lib/coral/network/default.rb +26 -0
- data/lib/coral/node/rackspace.rb +23 -0
- data/lib/coral_core.rb +249 -134
- data/lib/coral_core/config.rb +233 -275
- data/lib/coral_core/config/collection.rb +57 -0
- data/lib/coral_core/config/options.rb +70 -0
- data/lib/coral_core/config/project.rb +225 -0
- data/lib/coral_core/core.rb +19 -173
- data/lib/coral_core/event/puppet_event.rb +98 -0
- data/lib/coral_core/mixin/config_collection.rb +52 -0
- data/lib/coral_core/mixin/config_ops.rb +51 -0
- data/lib/coral_core/mixin/config_options.rb +38 -0
- data/lib/coral_core/mixin/lookup.rb +211 -0
- data/lib/coral_core/mixin/macro/object_interface.rb +292 -0
- data/lib/coral_core/mixin/macro/plugin_interface.rb +277 -0
- data/lib/coral_core/mixin/settings.rb +46 -0
- data/lib/coral_core/mixin/sub_config.rb +208 -0
- data/lib/coral_core/mod/hash.rb +29 -0
- data/lib/{hiera_backend.rb → coral_core/mod/hiera_backend.rb} +0 -0
- data/lib/coral_core/plugin.rb +261 -0
- data/lib/coral_core/plugin/command.rb +95 -0
- data/lib/coral_core/plugin/machine.rb +152 -0
- data/lib/coral_core/plugin/network.rb +24 -0
- data/lib/coral_core/plugin/node.rb +184 -0
- data/lib/coral_core/plugin_base.rb +147 -0
- data/lib/coral_core/repository.rb +471 -82
- data/lib/coral_core/util/cli.rb +293 -0
- data/lib/coral_core/util/data.rb +178 -8
- data/lib/coral_core/util/disk.rb +13 -0
- data/lib/coral_core/util/git.rb +35 -10
- data/lib/coral_core/{interface.rb → util/interface.rb} +31 -21
- data/lib/coral_core/util/process.rb +43 -0
- data/locales/en.yml +8 -0
- data/spec/coral_core/interface_spec.rb +45 -45
- metadata +109 -34
- data/.gitmodules +0 -12
- data/lib/coral_core/memory.rb +0 -226
- data/lib/coral_core/util/git/base.rb +0 -65
- data/lib/coral_core/util/git/lib.rb +0 -89
- data/lib/coral_core/util/git/remote.rb +0 -12
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
|
|
2
|
+
module Coral
|
|
3
|
+
class Config
|
|
4
|
+
class Collection
|
|
5
|
+
|
|
6
|
+
#-----------------------------------------------------------------------------
|
|
7
|
+
# Property accessor / modifiers
|
|
8
|
+
|
|
9
|
+
@@properties = {}
|
|
10
|
+
|
|
11
|
+
#---
|
|
12
|
+
|
|
13
|
+
def self.all
|
|
14
|
+
return @@properties
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#---
|
|
18
|
+
|
|
19
|
+
def self.get(name)
|
|
20
|
+
return @@properties[name.to_sym]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#---
|
|
24
|
+
|
|
25
|
+
def self.set(name, value)
|
|
26
|
+
@@properties[name.to_sym] = value
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#---
|
|
30
|
+
|
|
31
|
+
def self.delete(name)
|
|
32
|
+
@@properties.delete(name.to_sym)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
#---
|
|
36
|
+
|
|
37
|
+
def self.clear
|
|
38
|
+
@@properties = {}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
#---
|
|
42
|
+
|
|
43
|
+
def self.save
|
|
44
|
+
log_options = Options.get(:coral_log)
|
|
45
|
+
|
|
46
|
+
unless Util::Data.empty?(log_options[:config_log])
|
|
47
|
+
config_log = log_options[:config_log]
|
|
48
|
+
|
|
49
|
+
if log_options[:config_store]
|
|
50
|
+
Util::Disk.write(config_log, MultiJson.dump(@@properties, :pretty => true))
|
|
51
|
+
Util::Disk.close(config_log)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
module Coral
|
|
3
|
+
class Config
|
|
4
|
+
class Options
|
|
5
|
+
|
|
6
|
+
#-----------------------------------------------------------------------------
|
|
7
|
+
# Property accessors / modifiers
|
|
8
|
+
|
|
9
|
+
@@options = {}
|
|
10
|
+
|
|
11
|
+
#---
|
|
12
|
+
|
|
13
|
+
def self.contexts(contexts = [], hierarchy = [])
|
|
14
|
+
contexts = [ 'all', contexts ].flatten
|
|
15
|
+
|
|
16
|
+
unless hierarchy.is_a?(Array)
|
|
17
|
+
hierarchy = ( ! Util::Data.empty?(hierarchy) ? [ hierarchy ].flatten : [] )
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
hierarchy.each do |group|
|
|
21
|
+
group_contexts = Util::Data.prefix(group, contexts)
|
|
22
|
+
contexts = [ contexts, group_contexts ].flatten
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
return contexts
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
#---
|
|
29
|
+
|
|
30
|
+
def self.get(contexts, force = true)
|
|
31
|
+
options = {}
|
|
32
|
+
|
|
33
|
+
unless contexts.is_a?(Array)
|
|
34
|
+
contexts = ( ! Util::Data.empty?(contexts) ? [ contexts ].flatten : [] )
|
|
35
|
+
end
|
|
36
|
+
contexts.each do |name|
|
|
37
|
+
name = name.to_sym
|
|
38
|
+
if @@options.has_key?(name)
|
|
39
|
+
options = Util::Data.merge([ options, @@options[name] ], force)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
return options
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
#---
|
|
46
|
+
|
|
47
|
+
def self.set(contexts, options, force = true)
|
|
48
|
+
unless contexts.is_a?(Array)
|
|
49
|
+
contexts = ( ! Util::Data.empty?(contexts) ? [ contexts ].flatten : [] )
|
|
50
|
+
end
|
|
51
|
+
contexts.each do |name|
|
|
52
|
+
name = name.to_sym
|
|
53
|
+
current_options = ( @@options.has_key?(name) ? @@options[name] : {} )
|
|
54
|
+
@@options[name] = Util::Data.merge([ current_options, Config.symbol_map(options) ], force)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#---
|
|
59
|
+
|
|
60
|
+
def self.clear(contexts)
|
|
61
|
+
unless contexts.is_a?(Array)
|
|
62
|
+
contexts = [ contexts ]
|
|
63
|
+
end
|
|
64
|
+
contexts.each do |name|
|
|
65
|
+
@@options.delete(name.to_sym)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
|
|
2
|
+
module Coral
|
|
3
|
+
class Config
|
|
4
|
+
class Project < Config
|
|
5
|
+
|
|
6
|
+
include Mixin::SubConfig
|
|
7
|
+
|
|
8
|
+
#-----------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
def initialize(data = {}, defaults = {}, force = true)
|
|
11
|
+
super(data, defaults, force)
|
|
12
|
+
|
|
13
|
+
init_subconfig(true)
|
|
14
|
+
|
|
15
|
+
unless _get(:project)
|
|
16
|
+
_set(:project, Repository.open(_delete(:directory, Dir.pwd), {
|
|
17
|
+
:origin => _delete(:origin),
|
|
18
|
+
:revision => _delete(:revision)
|
|
19
|
+
}))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
_init(:autoload, true)
|
|
23
|
+
_init(:autosave, true)
|
|
24
|
+
_init(:autocommit, true)
|
|
25
|
+
_init(:commit_message, 'Saving state')
|
|
26
|
+
|
|
27
|
+
self.config_file = _get(:config_file, '')
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#---
|
|
31
|
+
|
|
32
|
+
def self.finalize(file_name)
|
|
33
|
+
proc do
|
|
34
|
+
Util::Disk.close(file_name)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
#---
|
|
39
|
+
|
|
40
|
+
#def inspect
|
|
41
|
+
# "#<#{self.class}: #{@absolute_config_file}>"
|
|
42
|
+
#end
|
|
43
|
+
|
|
44
|
+
#-----------------------------------------------------------------------------
|
|
45
|
+
# Checks
|
|
46
|
+
|
|
47
|
+
def can_persist?
|
|
48
|
+
success = project.can_persist?
|
|
49
|
+
success = false if Util::Data.empty?(@absolute_config_file)
|
|
50
|
+
return success
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
#-----------------------------------------------------------------------------
|
|
54
|
+
# Property accessors / modifiers
|
|
55
|
+
|
|
56
|
+
def autoload(default = false)
|
|
57
|
+
return _get(:autoload, default)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
#---
|
|
61
|
+
|
|
62
|
+
def autoload=autoload
|
|
63
|
+
_set(:autoload, test(autoload))
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
#---
|
|
67
|
+
|
|
68
|
+
def autosave(default = false)
|
|
69
|
+
return _get(:autosave, default)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
#---
|
|
73
|
+
|
|
74
|
+
def autosave=autosave
|
|
75
|
+
_set(:autosave, test(autosave))
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
#---
|
|
79
|
+
|
|
80
|
+
def autocommit(default = false)
|
|
81
|
+
return _get(:autocommit, default)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
#---
|
|
85
|
+
|
|
86
|
+
def autocommit=autocommit
|
|
87
|
+
_set(:autocommit, test(autocommit))
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
#---
|
|
91
|
+
|
|
92
|
+
def commit_message(default = false)
|
|
93
|
+
return _get(:commit_message, default)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
#---
|
|
97
|
+
|
|
98
|
+
def commit_message=commit_message
|
|
99
|
+
_set(:commit_message, string(commit_message))
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
#---
|
|
103
|
+
|
|
104
|
+
def project(default = nil)
|
|
105
|
+
return _get(:project, default)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
#---
|
|
109
|
+
|
|
110
|
+
def config_file(default = nil)
|
|
111
|
+
return _get(:config_file, default)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
#---
|
|
115
|
+
|
|
116
|
+
def config_file=file
|
|
117
|
+
unless Util::Data.empty?(file)
|
|
118
|
+
_set(:config_file, Util::Disk.filename(file))
|
|
119
|
+
end
|
|
120
|
+
set_absolute_config_file
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
#---
|
|
124
|
+
|
|
125
|
+
def set_absolute_config_file
|
|
126
|
+
if Util::Data.empty?(project.directory) || Util::Data.empty?(config_file)
|
|
127
|
+
@absolute_config_file = ''
|
|
128
|
+
else
|
|
129
|
+
@absolute_config_file = File.join(project.directory, config_file)
|
|
130
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@absolute_config_file))
|
|
131
|
+
end
|
|
132
|
+
load if autoload
|
|
133
|
+
return self
|
|
134
|
+
end
|
|
135
|
+
protected :set_absolute_config_file
|
|
136
|
+
|
|
137
|
+
#---
|
|
138
|
+
|
|
139
|
+
def set_location(directory)
|
|
140
|
+
if directory && directory.is_a?(Coral::Repository)
|
|
141
|
+
project.set_location(directory.directory)
|
|
142
|
+
elsif directory && directory.is_a?(String) || directory.is_a?(Symbol)
|
|
143
|
+
project.set_location(directory.to_s)
|
|
144
|
+
end
|
|
145
|
+
set_absolute_config_file if directory
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
#-----------------------------------------------------------------------------
|
|
149
|
+
|
|
150
|
+
def set(keys, value = '', options = {})
|
|
151
|
+
super(keys, value)
|
|
152
|
+
save(options) if autosave
|
|
153
|
+
return self
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
#---
|
|
157
|
+
|
|
158
|
+
def delete(keys, options = {})
|
|
159
|
+
super(keys)
|
|
160
|
+
save(options) if autosave
|
|
161
|
+
return self
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
#---
|
|
165
|
+
|
|
166
|
+
def clear(options = {})
|
|
167
|
+
super
|
|
168
|
+
save(options) if autosave
|
|
169
|
+
return self
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
#-----------------------------------------------------------------------------
|
|
173
|
+
# Import / Export
|
|
174
|
+
|
|
175
|
+
def import(properties, options = {})
|
|
176
|
+
super(properties, options)
|
|
177
|
+
save(options) if autosave
|
|
178
|
+
return self
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
#-----------------------------------------------------------------------------
|
|
182
|
+
# Configuration loading / saving
|
|
183
|
+
|
|
184
|
+
def load(options = {})
|
|
185
|
+
local_config = Config.ensure(options)
|
|
186
|
+
|
|
187
|
+
if can_persist? && File.exists?(@absolute_config_file)
|
|
188
|
+
raw = Util::Disk.read(@absolute_config_file)
|
|
189
|
+
if raw && ! raw.empty?
|
|
190
|
+
config.clear if local_config.get(:override, false)
|
|
191
|
+
config.import(Util::Data.parse_json(raw), local_config)
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
return self
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
#---
|
|
198
|
+
|
|
199
|
+
def save(options = {})
|
|
200
|
+
local_config = Config.ensure(options)
|
|
201
|
+
|
|
202
|
+
if can_persist?
|
|
203
|
+
rendering = Util::Data.to_json(config.export, local_config.get(:pretty, true))
|
|
204
|
+
if rendering && ! rendering.empty?
|
|
205
|
+
Util::Disk.write(@absolute_config_file, rendering)
|
|
206
|
+
project.commit(@absolute_config_file, local_config) if autocommit
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
return self
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
#---
|
|
213
|
+
|
|
214
|
+
def rm(options = {})
|
|
215
|
+
local_config = Config.ensure(options)
|
|
216
|
+
|
|
217
|
+
if can_persist?
|
|
218
|
+
config.clear
|
|
219
|
+
File.delete(@absolute_config_file)
|
|
220
|
+
project.commit(@absolute_config_file, local_config) if autocommit
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
end
|
data/lib/coral_core/core.rb
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
module Coral
|
|
3
|
-
class Core
|
|
3
|
+
class Core < Config
|
|
4
4
|
|
|
5
5
|
#-----------------------------------------------------------------------------
|
|
6
6
|
# Properties
|
|
7
7
|
|
|
8
|
-
@@ui = Interface.new("coral")
|
|
8
|
+
@@ui = Util::Interface.new("coral")
|
|
9
9
|
|
|
10
10
|
#-----------------------------------------------------------------------------
|
|
11
11
|
# Constructor / Destructor
|
|
12
12
|
|
|
13
|
-
def initialize(
|
|
14
|
-
|
|
13
|
+
def initialize(data = {}, defaults = {}, force = true)
|
|
14
|
+
super(data, defaults, force)
|
|
15
15
|
|
|
16
|
-
@ui = Interface.new(
|
|
16
|
+
@ui = Util::Interface.new(export)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
#---
|
|
20
|
+
|
|
21
|
+
def inspect
|
|
22
|
+
"#<#{self.class}: >"
|
|
17
23
|
end
|
|
18
24
|
|
|
19
25
|
#-----------------------------------------------------------------------------
|
|
@@ -21,7 +27,7 @@ class Core
|
|
|
21
27
|
|
|
22
28
|
attr_accessor :ui
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
#---
|
|
25
31
|
|
|
26
32
|
def self.ui
|
|
27
33
|
return @@ui
|
|
@@ -33,180 +39,20 @@ class Core
|
|
|
33
39
|
return @@ui.logger
|
|
34
40
|
end
|
|
35
41
|
|
|
42
|
+
#---
|
|
43
|
+
|
|
44
|
+
def self.logger=logger
|
|
45
|
+
self.class.logger = logger
|
|
46
|
+
end
|
|
47
|
+
|
|
36
48
|
#---
|
|
37
49
|
|
|
38
50
|
def logger
|
|
39
51
|
return self.class.logger
|
|
40
52
|
end
|
|
41
|
-
|
|
42
|
-
#---
|
|
43
|
-
|
|
44
|
-
def logger=logger
|
|
45
|
-
self.class.logger = logger
|
|
46
|
-
end
|
|
47
53
|
|
|
48
54
|
#-----------------------------------------------------------------------------
|
|
49
55
|
# General utilities
|
|
50
|
-
|
|
51
|
-
def self.symbol_map(data)
|
|
52
|
-
results = {}
|
|
53
|
-
return data unless data
|
|
54
|
-
|
|
55
|
-
case data
|
|
56
|
-
when Hash
|
|
57
|
-
data.each do |key, value|
|
|
58
|
-
results[key.to_sym] = symbol_map(value)
|
|
59
|
-
end
|
|
60
|
-
else
|
|
61
|
-
results = data
|
|
62
|
-
end
|
|
63
|
-
return results
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
#---
|
|
67
|
-
|
|
68
|
-
def symbol_map(data)
|
|
69
|
-
return self.class.symbol_map(data)
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
#---
|
|
73
|
-
|
|
74
|
-
def self.string_map(data)
|
|
75
|
-
results = {}
|
|
76
|
-
return data unless data
|
|
77
|
-
|
|
78
|
-
case data
|
|
79
|
-
when Hash
|
|
80
|
-
data.each do |key, value|
|
|
81
|
-
results[key.to_s] = string_map(value)
|
|
82
|
-
end
|
|
83
|
-
else
|
|
84
|
-
results = data
|
|
85
|
-
end
|
|
86
|
-
return results
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
#---
|
|
90
|
-
|
|
91
|
-
def string_map(data)
|
|
92
|
-
return self.class.string_map(data)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
#-----------------------------------------------------------------------------
|
|
96
|
-
|
|
97
|
-
def self.filter(data, method = false)
|
|
98
|
-
if method && method.is_a?(Symbol) &&
|
|
99
|
-
[ :array, :hash, :string, :symbol, :test ].include?(method.to_sym)
|
|
100
|
-
return send(method, data)
|
|
101
|
-
end
|
|
102
|
-
return data
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
#---
|
|
106
|
-
|
|
107
|
-
def filter(data, method = false)
|
|
108
|
-
return self.class.filter(data, method)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
#-----------------------------------------------------------------------------
|
|
112
|
-
|
|
113
|
-
def self.array(data, default = [], split_string = false)
|
|
114
|
-
result = default
|
|
115
|
-
if data
|
|
116
|
-
case data
|
|
117
|
-
when Array
|
|
118
|
-
result = data
|
|
119
|
-
when String
|
|
120
|
-
result = [ ( split_string ? data.split(/\s*,\s*/) : data ) ]
|
|
121
|
-
else
|
|
122
|
-
result = [ data ]
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
return result
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
#---
|
|
129
|
-
|
|
130
|
-
def array(data, default = [], split_string = false)
|
|
131
|
-
return self.class.array(data, default, split_string)
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
#---
|
|
135
|
-
|
|
136
|
-
def self.hash(data, default = {})
|
|
137
|
-
result = default
|
|
138
|
-
if data
|
|
139
|
-
case data
|
|
140
|
-
when Hash
|
|
141
|
-
result = data
|
|
142
|
-
else
|
|
143
|
-
result = {}
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
return result
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
#---
|
|
150
|
-
|
|
151
|
-
def hash(data, default = {})
|
|
152
|
-
return self.class.hash(data, default)
|
|
153
|
-
end
|
|
154
|
-
|
|
155
|
-
#---
|
|
156
|
-
|
|
157
|
-
def self.string(data, default = '')
|
|
158
|
-
result = default
|
|
159
|
-
if data
|
|
160
|
-
case data
|
|
161
|
-
when String
|
|
162
|
-
result = data
|
|
163
|
-
else
|
|
164
|
-
result = data.to_s
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
return result
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
#---
|
|
171
|
-
|
|
172
|
-
def string(data, default = '')
|
|
173
|
-
return self.class.string(data, default)
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
#---
|
|
177
|
-
|
|
178
|
-
def self.symbol(data, default = :undefined)
|
|
179
|
-
result = default
|
|
180
|
-
if data
|
|
181
|
-
case data
|
|
182
|
-
when Symbol
|
|
183
|
-
result = data
|
|
184
|
-
when String
|
|
185
|
-
result = data.to_sym
|
|
186
|
-
else
|
|
187
|
-
result = data.class.to_sym
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
return result
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
#---
|
|
194
|
-
|
|
195
|
-
def symbol(data, default = '')
|
|
196
|
-
return self.class.symbol(data, default)
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
#---
|
|
200
|
-
|
|
201
|
-
def self.test(data)
|
|
202
|
-
return false if Util::Data.empty?(data)
|
|
203
|
-
return true
|
|
204
|
-
end
|
|
205
|
-
|
|
206
|
-
#---
|
|
207
|
-
|
|
208
|
-
def test(data)
|
|
209
|
-
return self.class.test(data)
|
|
210
|
-
end
|
|
56
|
+
|
|
211
57
|
end
|
|
212
58
|
end
|