Handles `EnforcedStyle` configuration parameters.
# File lib/rubocop/cop/mixin/configurable_enforced_style.rb, line 38 def alternative_style a = cop_config['SupportedStyles'].map(&:to_sym) if a.size != 2 fail 'alternative_style can only be used when there are exactly ' '2 SupportedStyles' end style == a.first ? a.last : a.first end
# File lib/rubocop/cop/mixin/configurable_enforced_style.rb, line 19 def both_styles_detected # Both correct and opposite styles exist. self.config_to_allow_offenses = { 'Enabled' => false } end
# File lib/rubocop/cop/mixin/configurable_enforced_style.rb, line 12 def correct_style_detected # Enabled:true indicates, later when the opposite style is detected, # that the correct style is used somewhere. self.config_to_allow_offenses ||= { 'Enabled' => true } both_styles_detected if config_to_allow_offenses[parameter_name] end
# File lib/rubocop/cop/mixin/configurable_enforced_style.rb, line 6 def opposite_style_detected self.config_to_allow_offenses ||= { parameter_name => alternative_style.to_s } both_styles_detected if config_to_allow_offenses['Enabled'] end
# File lib/rubocop/cop/mixin/configurable_enforced_style.rb, line 47 def parameter_name 'EnforcedStyle' end
Generated with the Darkfish Rdoc Generator 2.