module DopCommon::Config::Helper::ClassMethods
Public Instance Methods
conf_var(variable, options = {})
click to toggle source
# File lib/dop_common/config/helper.rb, line 24 def conf_var(variable, options = {}) define_method(variable) do unless instance_variable_defined?("@#{variable}") default = default.call(self) if default.kind_of?(Proc) instance_variable_set "@#{variable}", options[:default] end instance_variable_get "@#{variable}" end attr_writer variable end
dop_home()
click to toggle source
# File lib/dop_common/config/helper.rb, line 20 def dop_home File.join(user.dir, '.dop') end
is_root?()
click to toggle source
# File lib/dop_common/config/helper.rb, line 16 def is_root? user.name == 'root' end
user()
click to toggle source
# File lib/dop_common/config/helper.rb, line 12 def user Etc.getpwuid(Process.uid) end