Module: SocialButtons::Assistant::ClassMethods

Defined in:
lib/social_buttons/view_helpers/assistant.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_options=(value) ⇒ Object (writeonly)

Sets the attribute default_options

Parameters:

  • value

    the value to set the attribute default_options to.



6
7
8
# File 'lib/social_buttons/view_helpers/assistant.rb', line 6

def default_options=(value)
  @default_options = value
end

Instance Method Details

#helpObject



12
13
14
# File 'lib/social_buttons/view_helpers/assistant.rb', line 12

def help
  "Please HELP by filling in the help of the #{myname} button :) (see google+ button code)"
end

#mynameObject



8
9
10
# File 'lib/social_buttons/view_helpers/assistant.rb', line 8

def myname
  self.name.demodulize
end

#options_to_data_params(opts) ⇒ Object



16
17
18
19
20
# File 'lib/social_buttons/view_helpers/assistant.rb', line 16

def options_to_data_params(opts)
  params = {}
  opts.each {|k, v| params["data-#{k}"] = v}
  params
end

#options_to_query_string(subject, opts) ⇒ Object



22
23
24
25
26
27
# File 'lib/social_buttons/view_helpers/assistant.rb', line 22

def options_to_query_string(subject, opts)
  # formulate the url, and then strip the part before first '?'
  query_params = opts.slice(:url, :media, :description)
  full_url = subject.url_for(query_params)
  full_url.sub(/^([^?]*)/, '')
end