Sha256: b64961396c491cfa332dd4919858f6682f8de807926b5763731e26d3935e050c

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8
require "yaml"

#
# Provides basic Facebook functionality. You can ask it for
# the current configuration strings like Facebook.api_key,
# Facebook.application_id and Facebook.application_secret.
#
module DeviseFacebookOpenGraph
  module Facebook
    module Config
      class << self

        # 
        # Overrides the default configuration file path which is
        # read from when requesting application_id, api_key,
        # application_secret etc.
        #
        #
        #
        attr_accessor :path

        %w(application_id api_key application_secret).each do |config_key|
          define_method config_key do
            instance_variable_get('@'+config_key) or 
            instance_variable_set('@'+config_key, config[config_key].value)
          end
        end
        
        def sdk_java_script_source
          "http://connect.facebook.net/#{I18n.locale}/all.js"
        end

        def facebook_session_name
          "fbs_#{application_id}"
        end

        private
          def config_file_path
            path || ::Rails.root.join('config', 'facebook.yml')
          end

          def config
            @config ||= YAML.parse_file(config_file_path)[::Rails.env]
          end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise_facebook_open_graph-0.0.6 lib/devise_facebook_open_graph/facebook/config.rb
devise_facebook_open_graph-0.0.5 lib/devise_facebook_open_graph/facebook/config.rb
devise_facebook_open_graph-0.0.4 lib/devise_facebook_open_graph/facebook/config.rb
devise_facebook_open_graph-0.0.3 lib/devise_facebook_open_graph/facebook/config.rb
devise_facebook_open_graph-0.0.2 lib/devise_facebook_open_graph/facebook/config.rb