Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/github_api2/core_ext/array.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#except(*keys) ⇒ Object

Returns a new arrray with keys removed



7
8
9
# File 'lib/github_api2/core_ext/array.rb', line 7

def except(*keys)
  self.dup.except!(*keys)
end

#except!(*items) ⇒ Object

Similar to except but modifies self



13
14
15
16
17
# File 'lib/github_api2/core_ext/array.rb', line 13

def except!(*items)
  copy = self.dup
  copy.reject! { |item| items.include? item }
  copy
end

#extract_options!Object

Selects a hash from the arguments list



21
22
23
# File 'lib/github_api2/core_ext/array.rb', line 21

def extract_options!
  last.is_a?(::Hash) ? pop : {}
end