Class: Inquisitive::Array
- Inherits:
-
Array
- Object
- Array
- Inquisitive::Array
show all
- Includes:
- Utils
- Defined in:
- lib/inquisitive/array.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments) ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/inquisitive/array.rb', line 21
def method_missing(method_name, *arguments)
if predicate_method? method_name
(include? predication(method_name)) ^ negated
else
super
end
end
|
Instance Attribute Details
#negated ⇒ Object
Returns the value of attribute negated.
7
8
9
|
# File 'lib/inquisitive/array.rb', line 7
def negated
@negated
end
|
Instance Method Details
#===(other) ⇒ Object
12
13
14
|
# File 'lib/inquisitive/array.rb', line 12
def === other
other.class == Class and other == ::Array or super
end
|
#exclude ⇒ Object
8
9
10
|
# File 'lib/inquisitive/array.rb', line 8
def exclude
self.dup.tap{ |a| a.negated = !a.negated }
end
|