Class: Jets::Core::Config::Info

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Includes:
Singleton
Defined in:
lib/jets/core/config/info.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



14
15
16
# File 'lib/jets/core/config/info.rb', line 14

def method_missing(name, *args)
  data.key?(name.to_sym) ? data[name.to_sym] : super
end

Instance Method Details

#dataObject



8
9
10
11
# File 'lib/jets/core/config/info.rb', line 8

def data
  data = File.exist?(path) ? YAML.load_file(path) : {}
  ActiveSupport::HashWithIndifferentAccess.new(data)
end

#pathObject

Do not use absolute path. This is because the path is written to the stage/code area



23
24
25
# File 'lib/jets/core/config/info.rb', line 23

def path
  "config/jets/info.yml"
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/jets/core/config/info.rb', line 18

def respond_to_missing?(name, include_private = false)
  data.key?(name.to_sym) || super
end