Class: Killbill::HelloWorld::Initializer

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/helloworld/initializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#listenerObject (readonly)

Returns the value of attribute listener.



5
6
7
# File 'lib/helloworld/initializer.rb', line 5

def listener
  @listener
end

Instance Method Details

#initialize!(conf_dir, kb_apis, logger) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/helloworld/initializer.rb', line 7

def initialize!(conf_dir, kb_apis, logger)
  # Parse the config file
  begin
    @config = YAML.load_file("#{conf_dir}/helloworld.yml") || {}
  rescue Errno::ENOENT
    logger.warn "Unable to find the config file #{conf_dir}/helloworld.yml"
    return
  end

  logger.log_level = Logger::DEBUG if (@config[:logger] || {})[:debug]

  initialize_active_record(@config[:database], logger)

  @listener = UserListener.new(kb_apis, logger)
end

#initialized?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/helloworld/initializer.rb', line 23

def initialized?
  !@listener.nil?
end