lib/procemon/mpatch/array.rb in procemon-0.0.1 vs lib/procemon/mpatch/array.rb in procemon-0.0.2

- old
+ new

@@ -29,12 +29,22 @@ array = self hash = Hash[array.map.with_index.to_a] return hash[target_element] end - # remove n. element + # remove n. element from the end + # and return a new object def pinch n=1 - return self[0..(self.count-2)] + return self[0..(self.count-(n+1))] + end + + # remove n. element from the end + # and return the original object + def pinch! n=1 + n.times do + self.pop + end + return self end # return boolean by other array # all element included or # not in the target array \ No newline at end of file