Class: Dexter::Matchers::AbstractMatcher
- Inherits:
-
Object
- Object
- Dexter::Matchers::AbstractMatcher
- Defined in:
- lib/dexter.rb
Direct Known Subclasses
Constant Summary collapse
- EXTENSIONS =
[]
Class Method Summary collapse
Instance Method Summary collapse
- #extension ⇒ Object
- #filename ⇒ Object
-
#initialize(filename) ⇒ AbstractMatcher
constructor
A new instance of AbstractMatcher.
- #organize! ⇒ Object
Constructor Details
#initialize(filename) ⇒ AbstractMatcher
Returns a new instance of AbstractMatcher.
56 57 58 59 |
# File 'lib/dexter.rb', line 56 def initialize(filename) raise "Not an allowed format!" unless self.class.allowed?(filename) @filename = filename end |
Class Method Details
.allowed?(filename) ⇒ Boolean
52 53 54 |
# File 'lib/dexter.rb', line 52 def self.allowed?(filename) self::EXTENSIONS.include? File.extname(filename).gsub(/^\./,"") end |
Instance Method Details
#extension ⇒ Object
65 66 67 |
# File 'lib/dexter.rb', line 65 def extension File.extname(@filename).gsub(/^\./,"") end |
#filename ⇒ Object
69 70 71 |
# File 'lib/dexter.rb', line 69 def filename @filename end |
#organize! ⇒ Object
61 62 63 |
# File 'lib/dexter.rb', line 61 def organize! raise "It's up to the subclass to implement this" end |