Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/git_hub/extensions.rb

Instance Method Summary collapse

Instance Method Details

#args_and_optsObject

Splits (arguments) Array into two components: enum for args and options Hash options Hash (if any) should be the last component of Array



17
18
19
20
21
22
23
24
# File 'lib/git_hub/extensions.rb', line 17

def args_and_opts 
  opts = self.last
  if opts.is_a?(Hash)
    [self[0..-2].to_enum, opts]
  else
    [self.to_enum, {}]
  end
end