Module: VmShepherd::BackportRefinements

Defined in:
lib/vm_shepherd/backport_refinements.rb

Class Method Summary collapse

Class Method Details

.ported_dig(obj, indices) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vm_shepherd/backport_refinements.rb', line 7

def self.ported_dig(obj, indices)
  head = indices.first
  new_obj = obj[head]
  if indices.count == 1
    new_obj
  elsif new_obj == nil
    return nil
  else
    tail = indices[1..-1]
    ported_dig(new_obj, tail)
  end
end

.should_refine?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/vm_shepherd/backport_refinements.rb', line 3

def self.should_refine?
  Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
end