Class: SocialSharePrivacy::Config::Services::Service

Inherits:
Object
  • Object
show all
Includes:
Evaluatable, JSONable
Defined in:
lib/social_share_privacy.rb

Direct Known Subclasses

Facebook, Gplus, Twitter

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Evaluatable

#eval

Methods included from JSONable

#to_s

Constructor Details

#initializeService



92
93
94
95
96
97
98
99
100
# File 'lib/social_share_privacy.rb', line 92

def initialize
  loc_s = 'social_share_privacy.' + self.class.name.split('::').last.downcase
  @txt_info = Proc.new { I18n.t("#{loc_s}.txt_info") }
  @txt_help = Proc.new { I18n.t("#{loc_s}.txt_help") }
  @txt_off = Proc.new { I18n.t("#{loc_s}.txt_off") }
  @txt_on = Proc.new { I18n.t("#{loc_s}.txt_on") }
  @display_name = Proc.new { I18n.t("#{loc_s}.display_name") }
  @dummy_button = Proc.new {|helper| helper.path_to_image('social_share_privacy/dummy_' + self.class.name.split('::').last.downcase + '.png')}
end

Instance Attribute Details

#dummy_button=(value) ⇒ Object (writeonly)

Sets the attribute dummy_button



90
91
92
# File 'lib/social_share_privacy.rb', line 90

def dummy_button=(value)
  @dummy_button = value
end

#languageObject

Returns the value of attribute language.



88
89
90
# File 'lib/social_share_privacy.rb', line 88

def language
  @language
end

#perma_optionObject

Returns the value of attribute perma_option.



89
90
91
# File 'lib/social_share_privacy.rb', line 89

def perma_option
  @perma_option
end

#referrer_trackObject

Returns the value of attribute referrer_track.



88
89
90
# File 'lib/social_share_privacy.rb', line 88

def referrer_track
  @referrer_track
end

#statusObject (readonly)

Returns the value of attribute status.



89
90
91
# File 'lib/social_share_privacy.rb', line 89

def status
  @status
end

Instance Method Details

#enabled=(value) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/social_share_privacy.rb', line 102

def enabled= value 
  if !!value == value
    if value 
      @status = 'on'
    else
      @status = 'off'
    end
  elsif value.is_a? Proc
    @status = Proc.new do |helper|
      if value.call(helper)
        @status = 'on'
      else
        @status = 'off'
      end
    end
  elsif value == 'on' || value == 'off'
    @status = value
  else
    raise ArgumentError, "Invalid option for enabled: #{value}"
  end
end