class Wanko::Data::Rule

Rule for matching against RSS items. Contains a regex for matching and a directory to download matched torrents to.

Attributes

dir[R]
regex[R]

Public Class Methods

new(regex, dir) click to toggle source
Public: Initialize a Rule object.

regex - String or Regexp for matching. dir - Directory to download matched torrents to.

# File lib/wanko/data.rb, line 42
def initialize(regex, dir)
  @regex = Regexp.new regex, Regexp::IGNORECASE
  @dir = dir
end

Public Instance Methods

==(other) click to toggle source

Public: Compare this Rule to another object.

other - Object to compare this Rule to.

Returns true if the regex and dir fields of this Rule are equal to

the corresponding fields in other, false otherwise.
# File lib/wanko/data.rb, line 64
def ==(other)
  regex == other.regex && dir == other.dir
end
=~(str) click to toggle source

Public: Match the regex of this Rule against a String

str - String to match.

Returns true if str matches, false otherwise.

# File lib/wanko/data.rb, line 54
def =~(str)
  regex =~ str
end