Class: ConradFiler::IdType
- Inherits:
-
Object
- Object
- ConradFiler::IdType
- Defined in:
- lib/conrad_filer/id_type.rb
Overview
An ID Type describes files in a directory using a regular expression. It is used by a rule to define which file types the rule applies to.
Instance Method Summary collapse
- #get_regexp ⇒ Object
- #ignore_case ⇒ Object
-
#initialize(db, a_hash) ⇒ IdType
constructor
A new instance of IdType.
- #match_regexp ⇒ Object
- #matches_pathname?(pathname) ⇒ Boolean
Constructor Details
#initialize(db, a_hash) ⇒ IdType
Returns a new instance of IdType.
8 9 10 |
# File 'lib/conrad_filer/id_type.rb', line 8 def initialize(db, a_hash) @db_rec = a_hash end |
Instance Method Details
#get_regexp ⇒ Object
24 25 26 27 |
# File 'lib/conrad_filer/id_type.rb', line 24 def get_regexp return @regexp if @regexp != nil @regexp = Regexp.new(self.match_regexp, self.ignore_case) end |
#ignore_case ⇒ Object
20 21 22 |
# File 'lib/conrad_filer/id_type.rb', line 20 def ignore_case @db_rec['IGNORE_CASE'][0,1].upcase == "T" end |
#match_regexp ⇒ Object
16 17 18 |
# File 'lib/conrad_filer/id_type.rb', line 16 def match_regexp @db_rec['MATCH_REGEXP'] end |
#matches_pathname?(pathname) ⇒ Boolean
12 13 14 |
# File 'lib/conrad_filer/id_type.rb', line 12 def matches_pathname?(pathname) pathname =~ self.get_regexp end |