Class: RTM::Rails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rtm/rails.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Create a new Configuration instance, initialized with the default values.



51
52
53
# File 'lib/rtm/rails.rb', line 51

def initialize
  self.topicmaps_configuration_file = default_topicmaps_configuration_file
end

Instance Attribute Details

#connectionsObject

The connection configuration for the current environment as collected from the configuration files.



43
44
45
# File 'lib/rtm/rails.rb', line 43

def connections
  @connections
end

#topicmapsObject

The topicmaps configuration for the current environment as collected from the configuration files.



47
48
49
# File 'lib/rtm/rails.rb', line 47

def topicmaps
  @topicmaps
end

#topicmaps_configuration_fileObject

The path to the topicmaps configuration file to use. (Defaults to config/topicmaps.yml.)

See Also:

  • Rails::Configuration#database_configuration_file


39
40
41
# File 'lib/rtm/rails.rb', line 39

def topicmaps_configuration_file
  @topicmaps_configuration_file
end

Instance Method Details

#default_topicmaps_configuration_fileObject



64
65
66
# File 'lib/rtm/rails.rb', line 64

def default_topicmaps_configuration_file
  File.join(::Rails.root, 'config', 'topicmaps.yml')
end

#topicmaps_configurationObject

Loads and returns the contents of the #database_configuration_file. The contents of the file are processed via ERB before being sent through YAML::load.

See Also:

  • Rails::Configuration#database_configuration


59
60
61
62
# File 'lib/rtm/rails.rb', line 59

def topicmaps_configuration
  require 'erb'
  YAML::load(ERB.new(::IO.read(topicmaps_configuration_file)).result)
end