Class: ProtoCov::TestFile

Inherits:
GenericFile show all
Defined in:
lib/protocov/test_file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GenericFile

#annotate!, #body, #classes, #defined_methods, #invoked_methods, #lines, #modules, #path

Constructor Details

#initialize(filename, path_prefix) ⇒ TestFile

Returns a new instance of TestFile.



17
18
19
20
# File 'lib/protocov/test_file.rb', line 17

def initialize(filename, path_prefix)
  @path_prefix = path_prefix
  @filename = filename
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



3
4
5
# File 'lib/protocov/test_file.rb', line 3

def filename
  @filename
end

#path_prefixObject (readonly)

Returns the value of attribute path_prefix.



3
4
5
# File 'lib/protocov/test_file.rb', line 3

def path_prefix
  @path_prefix
end

Class Method Details

.find_files_in(dir) ⇒ Object



6
7
8
9
10
# File 'lib/protocov/test_file.rb', line 6

def find_files_in(dir)
  dir.entries \
    .select  { |file| valid?(file) } \
    .collect { |file| new(file, File.expand_path(dir.path)) }
end

.valid?(file) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/protocov/test_file.rb', line 12

def valid?(file)
  file.match(/\.(html|js)/i)
end