Module: Babushka::VersionOf::Helpers

Included in:
DepDefiner, DepDefiner, PkgHelper
Defined in:
lib/babushka/version_of.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) VersionOf(first, *rest)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/babushka/version_of.rb', line 6

def VersionOf first, *rest
  # Convert the arguments into a VersionOf. If a single string argument is
  # passed, try splitting it on space to separate name and version. Otherwise,
  # pass the arguments as-is, splatting if required.
  if rest.any?
    Babushka::VersionOf.new(*[first].concat(rest))
  elsif first.is_a?(String)
    Babushka::VersionOf.new(*first.split(' ', 2))
  elsif first.is_a?(Array)
    Babushka::VersionOf.new(*first)
  else
    Babushka::VersionOf.new(first)
  end
end