Version 0.0.2
This commit is contained in:
parent
bf67c1752f
commit
8e883065ca
|
@ -1,4 +1,25 @@
|
||||||
|
|
||||||
|
class NotRegexp
|
||||||
|
def initialize r
|
||||||
|
@rx = r
|
||||||
|
end
|
||||||
|
def match l
|
||||||
|
! @rx.match( l)
|
||||||
|
end
|
||||||
|
def =~ l
|
||||||
|
! @rx =~ l
|
||||||
|
end
|
||||||
|
def -@
|
||||||
|
@rx
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class Regexp
|
||||||
|
def -@
|
||||||
|
NotRegexp.new self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class Functional
|
class Functional
|
||||||
include Enumerable
|
include Enumerable
|
||||||
|
|
||||||
|
@ -33,6 +54,10 @@ class Functional
|
||||||
push_method :select, &exe
|
push_method :select, &exe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def grep r
|
||||||
|
push_method :select, &r.method( :match)
|
||||||
|
end
|
||||||
|
|
||||||
def delete_if &exe
|
def delete_if &exe
|
||||||
push_method :delete_if, &exe
|
push_method :delete_if, &exe
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue