Class: SourceReaders::Flat

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target, files) ⇒ Flat

Returns a new instance of Flat.



25
26
27
28
29
30
31
# File 'lib/source_readers/flat.rb', line 25

def initialize(target, files)
  @target = target
  @metadata = ::Inspec::Metadata.new(nil)
  @tests = load_tests(files)
  @libraries = {}
  @data_files = {}
end

Instance Attribute Details

#data_filesObject (readonly)

Returns the value of attribute data_files.



23
24
25
# File 'lib/source_readers/flat.rb', line 23

def data_files
  @data_files
end

#librariesObject (readonly)

Returns the value of attribute libraries.



23
24
25
# File 'lib/source_readers/flat.rb', line 23

def libraries
  @libraries
end

#metadataObject (readonly)

Returns the value of attribute metadata.



23
24
25
# File 'lib/source_readers/flat.rb', line 23

def 
  @metadata
end

#testsObject (readonly)

Returns the value of attribute tests.



23
24
25
# File 'lib/source_readers/flat.rb', line 23

def tests
  @tests
end

Class Method Details

.resolve(target) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/source_readers/flat.rb', line 13

def self.resolve(target)
  # TODO: eventually remove the metadata.rb exception here
  # when we have fully phased out metadata.rb in 1.0
  files = target.files.find_all { |x|
    x.end_with?('.rb') && !x.include?('/') && x != 'metadata.rb'
  }
  return nil if files.empty?
  new(target, files)
end