Module: DopCommon::Config::Helper::ClassMethods
- Defined in:
- lib/dop_common/config/helper.rb
Instance Method Summary collapse
Instance Method Details
#conf_var(variable, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dop_common/config/helper.rb', line 24 def conf_var(variable, = {}) define_method(variable) do unless instance_variable_defined?("@#{variable}") default = default.call(self) if default.kind_of?(Proc) instance_variable_set "@#{variable}", [:default] end instance_variable_get "@#{variable}" end attr_writer variable end |
#dop_home ⇒ Object
20 21 22 |
# File 'lib/dop_common/config/helper.rb', line 20 def dop_home File.join(user.dir, '.dop') end |
#is_root? ⇒ Boolean
16 17 18 |
# File 'lib/dop_common/config/helper.rb', line 16 def is_root? user.name == 'root' end |
#user ⇒ Object
12 13 14 |
# File 'lib/dop_common/config/helper.rb', line 12 def user Etc.getpwuid(Process.uid) end |