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.



22
23
24
25
26
27
28
# File 'lib/source_readers/flat.rb', line 22

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.



20
21
22
# File 'lib/source_readers/flat.rb', line 20

def data_files
  @data_files
end

#librariesObject (readonly)

Returns the value of attribute libraries.



20
21
22
# File 'lib/source_readers/flat.rb', line 20

def libraries
  @libraries
end

#metadataObject (readonly)

Returns the value of attribute metadata.



20
21
22
# File 'lib/source_readers/flat.rb', line 20

def 
  @metadata
end

#testsObject (readonly)

Returns the value of attribute tests.



20
21
22
# File 'lib/source_readers/flat.rb', line 20

def tests
  @tests
end

Class Method Details

.resolve(target) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/source_readers/flat.rb', line 9

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 do |x|
    x.end_with?(".rb") && !x.include?("/") && x != "metadata.rb"
  end
  return nil if files.empty?

  new(target, files)
end