Class: Bookwatch::Postprocessing::Redirection
- Inherits:
-
Object
- Object
- Bookwatch::Postprocessing::Redirection
- Defined in:
- lib/bookwatch/postprocessing/redirection.rb
Instance Method Summary collapse
-
#initialize(fs, file_path) ⇒ Redirection
constructor
A new instance of Redirection.
- #redirected?(url) ⇒ Boolean
Constructor Details
#initialize(fs, file_path) ⇒ Redirection
Returns a new instance of Redirection.
4 5 6 7 8 |
# File 'lib/bookwatch/postprocessing/redirection.rb', line 4 def initialize(fs, file_path) @redirect_regexes = {} @redirect_strings = {} load!(fs, file_path) end |
Instance Method Details
#redirected?(url) ⇒ Boolean
10 11 12 13 |
# File 'lib/bookwatch/postprocessing/redirection.rb', line 10 def redirected?(url) @redirect_strings.has_key?(url) || @redirect_regexes.keys.detect {|regex| regex.match(url)} end |