Module: Squared::Common

Included in:
Squared::Config::Viewer, Repo::Project::Base, Repo::Workspace
Defined in:
lib/squared/common.rb,
lib/squared/common/task.rb,
lib/squared/common/class.rb,
lib/squared/common/shell.rb,
lib/squared/common/format.rb,
lib/squared/common/system.rb

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