Sha256: 7cd74f93e2b5c4c02cac425f3d6f2ea62149475f0d2e132a79cff1e8607afb63

Contents?: true

Size: 836 Bytes

Versions: 9

Compression:

Stored size: 836 Bytes

Contents

require 'active_support/ordered_options'
require 'yaml'

module Seajs::Rails
  class Config < ::ActiveSupport::OrderedOptions

    def initialize
      super
      # config/seajs_config.yml
      self.config_path = ::Rails.root.join('config', 'seajs_config.yml')
      # public/assets/seajs_map.json
      self.map_path = File.join(::Rails.public_path, ::Rails.application.config.assets.prefix, "seajs-map.json")
    end

    def load_config_from_file
      if File.exist?(self.config_path)
        self.merge! YAML.load_file(self.config_path).symbolize_keys
      end

      if File.exist?(self.map_path)
        self.map_json = File.open(map_path).read
        self.is_compiled = true
      else
        self.is_compiled = false
      end
    end

    def compiled?
      is_compiled
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
seajs-rails-0.0.9 lib/seajs/rails/config.rb
seajs-rails-0.0.8 lib/seajs/rails/config.rb
seajs-rails-0.0.7 lib/seajs/rails/config.rb
seajs-rails-0.0.6 lib/seajs/rails/config.rb
seajs-rails-0.0.5 lib/seajs/rails/config.rb
seajs-rails-0.0.4 lib/seajs/rails/config.rb
seajs-rails-0.0.3 lib/seajs/rails/config.rb
seajs-rails-0.0.2 lib/seajs/rails/config.rb
seajs-rails-0.0.1 lib/seajs/rails/config.rb