Class: Array

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/zkt_client/monky_patcher/array.rb

Overview

Extends the Array class with additional methods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#blank?, #present?

Class Method Details

.wrap(object) ⇒ Array

Wraps the given object in an array.

Parameters:

  • object (Object)

    the object to wrap

Returns:

  • (Array)

    the wrapped object as an array



13
14
15
16
17
18
19
# File 'lib/zkt_client/monky_patcher/array.rb', line 13

def self.wrap(object)
  if object.respond_to?(:to_a)
    object.to_a
  else
    [object]
  end
end

Instance Method Details

#exclude?(value) ⇒ Boolean

Checks if the array excludes the given value.

Parameters:

  • value (Object)

    the value to check

Returns:

  • (Boolean)

    true if the array does not include the value, false otherwise



25
26
27
# File 'lib/zkt_client/monky_patcher/array.rb', line 25

def exclude?(value)
  !include?(value)
end