Method: Array#|

Defined in:
ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb

#|(elem) ⇒ Object

call-seq:

ary | other_ary     -> new_ary

Set Union—Returns a new array by joining this array with other_ary, removing duplicates.

[ "a", "b", "c" ] | [ "c", "d", "a" ]
       #=> [ "a", "b", "c", "d" ]

Raises:



117
118
119
120
121
122
# File 'ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb', line 117

def |(elem)
  raise TypeError, "can't convert #{elem.class} into Array" unless elem.class == Array

  ary = self + elem
  ary.uniq! or ary
end