Class: Comatose::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/comatose/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



53
54
55
56
57
58
59
60
# File 'lib/comatose/configuration.rb', line 53

def initialize
  # Default procs for blockable attrs....
  @authorization       = Proc.new { true }
  @admin_authorization = Proc.new { true }
  @admin_get_author    = Proc.new { request.env['REMOTE_ADDR'] }
  @admin_get_root_page = Proc.new { Page.root }
  @after_setup         = Proc.new { true }
end

Instance Method Details

#include!Object



72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/comatose/configuration.rb', line 72

def include!
  Comatose.logger.debug "Including!: #{@includes.to_s}"
  @includes.each do |include_this|
    begin
      Comatose.logger.debug "including #{include_this.to_s}"
      Comatose.send(:include, include_this)
    rescue => e
      Comatose.logger.debug "Unable to include config item: #{include_this.to_s}"
      Comatose.logger.debug e.message
    end
  end
end

#validate!Object



63
64
65
66
67
68
69
# File 'lib/comatose/configuration.rb', line 63

def validate!
  Comatose.logger.debug "Validating!"
  raise Comatose::ConfigurationError.new( "admin_get_author must be a Proc or Symbol" ) unless @admin_get_author.is_a? Proc or @admin_get_author.is_a? Symbol
  #raise ConfigurationError.new( "admin_authorization must be a Proc or Symbol" ) unless @admin_authorization.is_a? Proc or @admin_authorization.is_a? Symbol
  #raise ConfigurationError.new( "authorization must be a Proc or Symbol" ) unless @authorization.is_a? Proc or @authorization.is_a? Symbol
  true
end