Sha256: b7216e94270eeb52bc5bd61c13a5073dae1ae795d00bbe2c9f4f5d81e3875c6e

Contents?: true

Size: 1.47 KB

Versions: 52

Compression:

Stored size: 1.47 KB

Contents

module God
  
  module Configurable
    # Override this method in your Configurable (optional)
    #
    # Called once after the Configurable has been sent to the block and attributes have been
    # set. Do any post-processing on attributes here
    def prepare
      
    end
    
    def reset
      
    end
    
    # Override this method in your Configurable (optional)
    #
    # Called once during evaluation of the config file. Return true if valid, false otherwise
    #
    # A convenience method 'complain' is available that will print out a message and return false,
    # making it easy to report multiple validation errors:
    #
    #   def valid?
    #     valid = true
    #     valid &= complain("You must specify the 'pid_file' attribute for :memory_usage") if self.pid_file.nil?
    #     valid &= complain("You must specify the 'above' attribute for :memory_usage") if self.above.nil?
    #     valid
    #   end
    def valid?
      true
    end
    
    def base_name
      x = 1 # fix for MRI's local scope optimization bug DO NOT REMOVE!
      self.class.name.split('::').last
    end
    
    def friendly_name
      base_name
    end
    
    def self.complain(text, c = nil)
      watch = c.watch rescue nil
      msg = ""
      msg += "#{watch.name}: " if watch
      msg += text
      msg += " for #{c.friendly_name}" if c
      applog(watch, :error, msg)
      false
    end
    
    def complain(text, c = nil)
      Configurable.complain(text, c)
    end
  end
  
end

Version data entries

52 entries across 52 versions & 19 rubygems

Version Path
dguettler-god-0.7.13.2 lib/god/configurable.rb
dguettler-god-0.7.13.3 lib/god/configurable.rb
dosire-god-0.7.10 lib/god/configurable.rb
dosire-god-0.7.12 lib/god/configurable.rb
dosire-god-0.7.9 lib/god/configurable.rb
dunedain289-god-0.7.12.1 lib/god/configurable.rb
dustin-god-0.7.7.1 lib/god/configurable.rb
eric-god-0.7.10 lib/god/configurable.rb
eric-god-0.7.11 lib/god/configurable.rb
eric-god-0.7.12 lib/god/configurable.rb
eric-god-0.7.14 lib/god/configurable.rb
eric-god-0.7.7 lib/god/configurable.rb
fotonauts-god-0.7.10 lib/god/configurable.rb
fotonauts-god-0.7.12 lib/god/configurable.rb
gohanlonllc-god-0.7.9 lib/god/configurable.rb
gordoncww-god-0.7.11.1 lib/god/configurable.rb
jreynolds-god-0.7.13 lib/god/configurable.rb
jwilkins-god-0.7.9 lib/god/configurable.rb
mathieuravaux-god-0.7.11 lib/god/configurable.rb
mojombo-god-0.7.10 lib/god/configurable.rb