Class: FuncE::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/func_e/config.rb

Overview

Singleton class for configuring FuncE.

Constant Summary collapse

DEFAULT_INSTALL_DIR =
'funcs'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#fn_dir_pathObject

Returns the value of attribute fn_dir_path.



13
14
15
# File 'lib/func_e/config.rb', line 13

def fn_dir_path
  @fn_dir_path
end

Class Method Details

.configObject



19
20
21
# File 'lib/func_e/config.rb', line 19

def self.config
  instance
end

.configure {|instance| ... } ⇒ Object

Yields:

  • (instance)


15
16
17
# File 'lib/func_e/config.rb', line 15

def self.configure
  yield instance
end

.get(key) ⇒ Object



23
24
25
# File 'lib/func_e/config.rb', line 23

def self.get(key)
  instance.send(key)
end

.install_pathObject



27
28
29
30
31
32
33
34
35
# File 'lib/func_e/config.rb', line 27

def self.install_path
  if defined?(Rails)
    Rails.root.join(@fn_dir_path || DEFAULT_INSTALL_DIR)
  elsif defined?(Bundler)
    Bundler.root.join(@fn_dir_path || DEFAULT_INSTALL_DIR)
  else
    Pathname.new(Dir.pwd).join(@fn_dir_path || DEFAULT_INSTALL_DIR)
  end
end