Class: Suspenders::StylelintGenerator::ToggleComments

Inherits:
Object
  • Object
show all
Defined in:
lib/suspenders/generators/stylelint_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(base, filename, pattern) ⇒ ToggleComments

Returns a new instance of ToggleComments.


34
35
36
37
38
# File 'lib/suspenders/generators/stylelint_generator.rb', line 34

def initialize(base, filename, pattern)
  @base = base
  @filename = filename
  @pattern = pattern
end

Instance Method Details

#invoke!Object


40
41
42
# File 'lib/suspenders/generators/stylelint_generator.rb', line 40

def invoke!
  @base.uncomment_lines(@filename, @pattern)
end

#revoke!Object


44
45
46
47
48
49
# File 'lib/suspenders/generators/stylelint_generator.rb', line 44

def revoke!
  @base.behavior = :invoke
  @base.comment_lines(@filename, @pattern)
ensure
  @base.behavior = :revoke
end