Class: SocialSharePrivacy::Config::Services::Service
- Includes:
- Evaluatable, JSONable
- Defined in:
- lib/social_share_privacy.rb
Instance Attribute Summary collapse
-
#dummy_button ⇒ Object
writeonly
Sets the attribute dummy_button.
-
#language ⇒ Object
Returns the value of attribute language.
-
#perma_option ⇒ Object
Returns the value of attribute perma_option.
-
#referrer_track ⇒ Object
Returns the value of attribute referrer_track.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #enabled=(value) ⇒ Object
-
#initialize ⇒ Service
constructor
A new instance of Service.
Methods included from Evaluatable
Methods included from JSONable
Constructor Details
#initialize ⇒ Service
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 (value) @dummy_button = value end |
#language ⇒ Object
Returns the value of attribute language.
88 89 90 |
# File 'lib/social_share_privacy.rb', line 88 def language @language end |
#perma_option ⇒ Object
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_track ⇒ Object
Returns the value of attribute referrer_track.
88 89 90 |
# File 'lib/social_share_privacy.rb', line 88 def referrer_track @referrer_track end |
#status ⇒ Object (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 |