Class: FacebookSocialPlugins::Plugin::Social

Inherits:
UiHelper
  • Object
show all
Defined in:
lib/facebook-social_plugins/plugin/social.rb

Instance Attribute Summary collapse

Attributes inherited from UiHelper

#html, #javascript

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Social

Returns a new instance of Social.



6
7
8
9
# File 'lib/facebook-social_plugins/plugin/social.rb', line 6

def initialize options = {}
	@options = options
	validate!
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/facebook-social_plugins/plugin/social.rb', line 4

def options
  @options
end

Instance Method Details

#renderObject



11
12
13
# File 'lib/facebook-social_plugins/plugin/social.rb', line 11

def render
	 :div, '', render_options.merge(:class => plugin_class)
end

#validate!Object

the :special type indicates call to special type validator



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/facebook-social_plugins/plugin/social.rb', line 16

def validate!
	return if options.empty?
	valid_options = {}
	options.each do |key, value|
		attr_key = find_att_key(key)
		raise ArgumentError, "Unknown or unsupported attribute #{key}" unless attr_key
		attributes[attr_key] == :special ? send("validate_#{key.to_s.underscore}", value) : valid?(value, attributes[attr_key])
		valid_options[attr_key] = value
	end
	@options = valid_options
end