Class: Daru::Core::Query::BoolArray

Inherits:
Object
  • Object
show all
Defined in:
lib/daru/core/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(barry) ⇒ BoolArray

Returns a new instance of BoolArray.



7
8
9
# File 'lib/daru/core/query.rb', line 7

def initialize barry
  @barry = barry
end

Instance Attribute Details

#barryObject (readonly)

Returns the value of attribute barry.



5
6
7
# File 'lib/daru/core/query.rb', line 5

def barry
  @barry
end

Instance Method Details

#!Object



23
24
25
# File 'lib/daru/core/query.rb', line 23

def !
  BoolArray.new(@barry.map(&:!))
end

#&(other) ⇒ Object Also known as: and



11
12
13
# File 'lib/daru/core/query.rb', line 11

def & other
  BoolArray.new(@barry.zip(other.barry).map { |b, o| b && o })
end

#==(other) ⇒ Object



27
28
29
# File 'lib/daru/core/query.rb', line 27

def == other
  @barry == other.barry
end

#inspectObject



35
36
37
# File 'lib/daru/core/query.rb', line 35

def inspect
  "#<#{self.class}:#{object_id} bool_arry=#{@barry}>"
end

#to_aObject



31
32
33
# File 'lib/daru/core/query.rb', line 31

def to_a
  @barry
end

#|(other) ⇒ Object Also known as: or



17
18
19
# File 'lib/daru/core/query.rb', line 17

def | other
  BoolArray.new(@barry.zip(other.barry).map { |b, o| b || o })
end