Class: SocialSharePrivacy::Config::Services::Facebook

Inherits:
Service show all
Defined in:
lib/social_share_privacy.rb

Constant Summary collapse

@@RE_LOCALE =
Regexp.new(/^[a-z]{2}_[A-Z]{2}$/)

Instance Attribute Summary collapse

Attributes inherited from Service

#dummy_button, #language, #perma_option, #referrer_track, #status

Instance Method Summary collapse

Methods inherited from Service

#enabled=, #initialize

Methods included from JSONable

#to_s

Constructor Details

This class inherits a constructor from SocialSharePrivacy::Config::Services::Service

Instance Attribute Details

#actionObject

Returns the value of attribute action.



150
151
152
# File 'lib/social_share_privacy.rb', line 150

def action
  @action
end

Instance Method Details

#eval(helper) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/social_share_privacy.rb', line 157

def eval helper
  result = super helper
  result.dummy_button = helper.path_to_image('social_share_privacy/dummy_facebook_' + result.action.to_s + '_de.png') if result.language.to_s.start_with?('de')
  unless @@RE_LOCALE.match(result.language)
    if I18n.available_locales.include? result.language.to_sym
      cur_loc = I18n.locale
      I18n.locale = result.language.to_sym
      result.language = I18n.t('social_share_privacy.full_locale')
      I18n.locale = cur_loc
    else result.language = 'en_US'
    end
  end
  result
end