Class: ConfigSL::FileFormat::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/configsl/file_format/base.rb

Overview

This class is abstract.

Subclass and override ‘#read` and `.extensions` to implement a

Base class for file format support.

file format.

Direct Known Subclasses

Json, Yaml

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Base



10
11
12
# File 'lib/configsl/file_format/base.rb', line 10

def initialize(file)
  @file = file
end

Class Method Details

.extensionsArray<Symbol>

Extensions used to identify the file format.

Values should be returned in order of preference.



19
20
21
# File 'lib/configsl/file_format/base.rb', line 19

def self.extensions
  []
end

Instance Method Details

#readHash{Symbol => Object}

Reads the file and returns a hash of configuration values.

Raises:

  • (NotImplementedError)

    If not implemented.



28
29
30
# File 'lib/configsl/file_format/base.rb', line 28

def read
  raise NotImplementedError, 'Not implemented'
end