jweinst1
1/7/2016 - 2:13 AM

text collector in ruby

text collector in ruby

#basic text collector in ruby

class Textcollector
    def initialize(pattern)
        @bin = []
        @pattern = pattern
    end
    def collect(string)
        if @pattern =~ string
            @bin << string
        end
    end
    def getmatches
        return @bin
    end
end