Sha256: e94fc431bbfadcb18f865e24bb5ebb1e601979084c4ba36f4f135efcfbbe3ad8

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

module BlogBasic
  class BlogConf                                                        
    #include Singleton                                                             

    #def initialize                                                                
    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 

    #def self.data
    #  @settings
    #end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
blog_basic-0.1.14 lib/blog_basic/blog_conf.rb
blog_basic-0.1.13 lib/blog_basic/blog_conf.rb
blog_basic-0.1.9 lib/blog_basic/blog_conf.rb
blog_basic-0.1.6 lib/blog_basic/blog_conf.rb