Class: RuboCop::Cop::PreferredDelimiters
- Inherits:
-
Object
- Object
- RuboCop::Cop::PreferredDelimiters
- Defined in:
- lib/rubocop/cop/mixin/preferred_delimiters.rb
Overview
Common functionality for handling percent literal delimiters.
Constant Summary collapse
- PERCENT_LITERAL_TYPES =
%w[% %i %I %q %Q %r %s %w %W %x].freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #delimiters ⇒ Object
-
#initialize(type, config, preferred_delimiters) ⇒ PreferredDelimiters
constructor
A new instance of PreferredDelimiters.
Constructor Details
#initialize(type, config, preferred_delimiters) ⇒ PreferredDelimiters
Returns a new instance of PreferredDelimiters.
11 12 13 14 15 |
# File 'lib/rubocop/cop/mixin/preferred_delimiters.rb', line 11 def initialize(type, config, preferred_delimiters) @type = type @config = config @preferred_delimiters = preferred_delimiters end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/rubocop/cop/mixin/preferred_delimiters.rb', line 7 def config @config end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/rubocop/cop/mixin/preferred_delimiters.rb', line 7 def type @type end |
Instance Method Details
#delimiters ⇒ Object
17 18 19 |
# File 'lib/rubocop/cop/mixin/preferred_delimiters.rb', line 17 def delimiters preferred_delimiters[type].chars end |