Class: FileChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/file_checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileChecker

Returns a new instance of FileChecker.



4
5
6
7
8
9
10
# File 'lib/file_checker.rb', line 4

def initialize(path)
  @path_to_check      = path
  @header_path        = path
  @implementation_path = nil
  @error_msg          = []
  @path_ok            = true
end

Instance Attribute Details

#error_msgObject

Returns the value of attribute error_msg.



2
3
4
# File 'lib/file_checker.rb', line 2

def error_msg
  @error_msg
end

#header_pathObject

Returns the value of attribute header_path.



2
3
4
# File 'lib/file_checker.rb', line 2

def header_path
  @header_path
end

#implementation_pathObject

Returns the value of attribute implementation_path.



2
3
4
# File 'lib/file_checker.rb', line 2

def implementation_path
  @implementation_path
end

#path_okObject

Returns the value of attribute path_ok.



2
3
4
# File 'lib/file_checker.rb', line 2

def path_ok
  @path_ok
end

#path_to_checkObject

Returns the value of attribute path_to_check.



2
3
4
# File 'lib/file_checker.rb', line 2

def path_to_check
  @path_to_check
end

Instance Method Details

#check_file_pathObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/file_checker.rb', line 12

def check_file_path
  unless valid_header_file?
    @path_ok = false
    @error_msg << "This is not a header file."
  end

  unless valid_implementation_file?
    @path_ok = false
    @error_msg << "There is no implementation file for this header file."
  end
end