Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/ergo/core_ext/true_class.rb

Overview

class TrueArray < Array

def each; end

def size
  1  # ?
end

def empty?
  false
end

def &(other)
  other.dup
end

def |(other)
  other.dup
end

## If this would have worked we would not have had
## to override Array.
#def coerce(other)
#  return self, other
#end

end

Instance Method Summary collapse

Instance Method Details

#&(other) ⇒ Object



55
56
57
# File 'lib/ergo/core_ext/true_class.rb', line 55

def &(other)
  TrueClass === other ? dup : and_without_t(other)
end

#and_without_tObject



48
# File 'lib/ergo/core_ext/true_class.rb', line 48

alias and_without_t :&

#or_without_tObject



49
# File 'lib/ergo/core_ext/true_class.rb', line 49

alias or_without_t :|

#|(other) ⇒ Object



51
52
53
# File 'lib/ergo/core_ext/true_class.rb', line 51

def |(other)
  TrueClass === other ? dup : or_without_t(other)
end