Class: Inquisitive::Array

Inherits:
Array
  • Object
show all
Includes:
Inquisitive
Defined in:
lib/inquisitive/array.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inquisitive

[], present?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments) ⇒ Object (private)



15
16
17
18
19
20
21
# File 'lib/inquisitive/array.rb', line 15

def method_missing(method_name, *arguments)
  if predicate_method? method_name
    (include? predication(method_name)) ^ negated
  else
    super
  end
end

Instance Attribute Details

#arrayObject

Returns the value of attribute array.



4
5
6
# File 'lib/inquisitive/array.rb', line 4

def array
  @array
end

#negatedObject

Returns the value of attribute negated.



4
5
6
# File 'lib/inquisitive/array.rb', line 4

def negated
  @negated
end

Instance Method Details

#excludeObject



6
7
8
# File 'lib/inquisitive/array.rb', line 6

def exclude
  self.dup.tap{ |a| a.negated = !a.negated }
end