Module: Squared::Common
Defined Under Namespace
Modules: Format, Shell, System, Task
Classes: JoinSet
Instance Method Summary
collapse
Instance Method Details
#as_a(obj) ⇒ Object
54
55
56
57
58
|
# File 'lib/squared/common.rb', line 54
def as_a(obj)
return [] if obj.nil?
obj.is_a?(::Array) ? obj : [obj]
end
|
#get(key) ⇒ Object
42
43
44
|
# File 'lib/squared/common.rb', line 42
def get(key)
VAR[key.is_a?(::String) ? key.to_sym : key]
end
|
#message(*args, hint: nil) ⇒ Object
50
51
52
|
# File 'lib/squared/common.rb', line 50
def message(*args, hint: nil)
args.reject(&:empty?).join(' => ') + (hint ? " (#{hint})" : '')
end
|
#set(key, val) ⇒ Object
46
47
48
|
# File 'lib/squared/common.rb', line 46
def set(key, val)
VAR[key.is_a?(::String) ? key.to_sym : key] = val
end
|