Class: Confy::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/confy/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Core

Returns a new instance of Core.

Raises:



4
5
6
7
8
9
10
11
# File 'lib/confy/core.rb', line 4

def initialize *args
  @path, *rest = args
  tail = rest.pop
  if tail.is_a?(Hash)
    set_options tail
  end
  raise FileNotFoundError unless @path && File.exist?(@path)
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



3
4
5
# File 'lib/confy/core.rb', line 3

def backend
  @backend
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/confy/core.rb', line 3

def path
  @path
end

Instance Method Details

#inspectObject



13
14
15
# File 'lib/confy/core.rb', line 13

def inspect
  backend ? backend.inspect : "<Confy::Core>"
end

#parseObject



17
18
19
20
# File 'lib/confy/core.rb', line 17

def parse
  @backend ||= Backend::Base.which(@path)
  @backend.new @path
end