Class: Parsefiles::FileOps
- Inherits:
-
Object
- Object
- Parsefiles::FileOps
- Includes:
- Parse
- Defined in:
- lib/parsefiles/file_ops.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Instance Method Summary collapse
- #encode_string(input) ⇒ Object
- #get_file_type ⇒ Object
-
#initialize(file, pattern) ⇒ FileOps
constructor
A new instance of FileOps.
- #match_line(line) ⇒ Object
- #parse_file ⇒ Object
Methods included from Parse
#parse_gz, #parse_log, #parse_zip
Constructor Details
#initialize(file, pattern) ⇒ FileOps
Returns a new instance of FileOps.
10 11 12 13 |
# File 'lib/parsefiles/file_ops.rb', line 10 def initialize(file,pattern) @file = file @pattern = pattern end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
8 9 10 |
# File 'lib/parsefiles/file_ops.rb', line 8 def file @file end |
#pattern ⇒ Object
Returns the value of attribute pattern.
8 9 10 |
# File 'lib/parsefiles/file_ops.rb', line 8 def pattern @pattern end |
Instance Method Details
#encode_string(input) ⇒ Object
29 30 31 |
# File 'lib/parsefiles/file_ops.rb', line 29 def encode_string(input) encode_it(input) end |
#get_file_type ⇒ Object
15 16 17 |
# File 'lib/parsefiles/file_ops.rb', line 15 def get_file_type File.extname(@file).gsub!(/\./,'') end |
#match_line(line) ⇒ Object
24 25 26 27 |
# File 'lib/parsefiles/file_ops.rb', line 24 def match_line(line) line = encode_string(line) p line if line.match(@pattern) end |
#parse_file ⇒ Object
19 20 21 22 |
# File 'lib/parsefiles/file_ops.rb', line 19 def parse_file method_name = "parse_#{get_file_type}" self.send method_name.to_sym end |