Module: Google::Search::SafetyLevel
Constant Summary collapse
- SAFETY_LEVELS =
– Constants ++
:active, :moderate, :off
Instance Attribute Summary collapse
-
#safety_level ⇒ Object
Safety level:.
Instance Method Summary collapse
-
#get_uri_params ⇒ Object
:nodoc:.
-
#initialize(options = {}, &block) ⇒ Object
:nodoc:.
Instance Attribute Details
#safety_level ⇒ Object
Safety level:
- :active | :high
- :moderate | :medium
- :off
20 21 22 |
# File 'lib/google-search/search/mixins/safety_level.rb', line 20 def safety_level @safety_level end |
Instance Method Details
#get_uri_params ⇒ Object
:nodoc:
31 32 33 34 35 36 37 |
# File 'lib/google-search/search/mixins/safety_level.rb', line 31 def get_uri_params @safety_level = :off if @safety_level == :none @safety_level = :moderate if @safety_level == :medium @safety_level = :active if @safety_level == :high validate(:safety_level) { |level| level.nil? || SAFETY_LEVELS.include?(level) } super + [[:safe, safety_level]] end |
#initialize(options = {}, &block) ⇒ Object
:nodoc:
24 25 26 27 |
# File 'lib/google-search/search/mixins/safety_level.rb', line 24 def initialize = {}, &block @safety_level = .delete :safety_level super end |