In Files

Parent

Files

Class/Module Index [+]

Quicksearch

Module

Public Instance Methods

safe_attr_accessor(*args) click to toggle source
# File lib/god.rb, line 134
def safe_attr_accessor(*args)
  args.each do |arg|
    define_method((arg.to_s + "=").intern) do |other|
      if !self.running && self.inited
        abort "God.#{arg} must be set before any Tasks are defined"
      end

      if self.running && self.inited
        applog(nil, :warn, "God.#{arg} can't be set while god is running")
        return
      end

      instance_variable_set(('@' + arg.to_s).intern, other)
    end

    define_method(arg) do
      instance_variable_get(('@' + arg.to_s).intern)
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.