Module: Facebooker2::Rails::Helpers

Includes:
FacebookConnect, Javascript, RequestForms, User
Defined in:
lib/facebooker2/rails/helpers.rb,
lib/facebooker2/rails/helpers/user.rb,
lib/facebooker2/rails/helpers/javascript.rb,
lib/facebooker2/rails/helpers/request_forms.rb,
lib/facebooker2/rails/helpers/facebook_connect.rb

Defined Under Namespace

Modules: FacebookConnect, Javascript, RequestForms, User

Constant Summary collapse

FB_ALWAYS_VALID_OPTION_KEYS =
[:class, :style]

Constants included from User

User::FB_NAME_OPTION_KEYS_TO_TRANSFORM, User::FB_NAME_VALID_OPTION_KEYS, User::FB_PROFILE_PIC_OPTION_KEYS_TO_TRANSFORM, User::FB_PROFILE_PIC_VALID_OPTION_KEYS, User::VALID_FB_PROFILE_PIC_SIZES

Instance Method Summary collapse

Methods included from User

#fb_name, #fb_profile_pic, #validate_fb_profile_pic_size

Methods included from RequestForms

#fb_forgery_protection_token_tag, #fb_multi_friend_selector, #fb_req_choice, #fb_request_form

Methods included from Javascript

#fb_connect_async_js

Methods included from FacebookConnect

#fb_login, #fb_login_and_redirect, #fb_logout_link, #fb_server_fbml

Instance Method Details

#fb_assert_valid_keys(options, *valid_keys) ⇒ Object

Raises:

  • (ArgumentError)


26
27
28
29
# File 'lib/facebooker2/rails/helpers.rb', line 26

def fb_assert_valid_keys(options,*valid_keys)
  unknown_keys = options.keys - [valid_keys + FB_ALWAYS_VALID_OPTION_KEYS].flatten
  raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
end

#fb_stringify_vals(hash) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/facebooker2/rails/helpers.rb', line 9

def fb_stringify_vals(hash)
 result={}
 hash.each do |key,value|
   result[key]=value.to_s
 end
 result
end

#fb_transform_keys(options, transformation_hash) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/facebooker2/rails/helpers.rb', line 16

def fb_transform_keys(options,transformation_hash)
  new_hash = {}
  options.each do |key,value|
    new_key = transformation_hash[key]||key
    new_hash[new_key]=value
  end
  new_hash
end