Class: ConfigType::Json

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extensionsObject



38
39
40
# File 'lib/config_file/config_type.rb', line 38

def self.extensions
  [".json"]
end

Instance Method Details

#read(file_name) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/config_file/config_type.rb', line 42

def read file_name
  interpolator = TextInterpolator.new

  content = File.read(file_name)

  hash = ::JSON.parse(content, :symbolize_names => true)

  interpolator.interpolate hash
end