Class: BlogBasic::BlogConf
- Inherits:
-
Object
- Object
- BlogBasic::BlogConf
- Defined in:
- lib/blog_basic/blog_conf.rb
Class Method Summary collapse
-
.data ⇒ Object
def initialize.
Class Method Details
.data ⇒ Object
def initialize
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/blog_basic/blog_conf.rb', line 6 def self.data #@data = YAML.load_file("#{rails_root}/config/" + "blog_basic.yml") config_filename = "blog_basic.yml" if defined?(Rails) rails_root = Rails.root elsif defined?(RAILS_ROOT) rails_root = RAILS_ROOT else puts "Unable to load rails" return end file_name = "#{rails_root}/config/" + config_filename if File.exists?(file_name) begin @settings = YAML::load(File.open(file_name).read) rescue Exception => e puts config_filename + "config file is invalid" end else puts 'No ' + config_filename + ' config file' end #file_name @settings end |