Class: CodeReaper::Strip

Inherits:
Object
  • Object
show all
Defined in:
lib/code_reaper/strip.rb

Constant Summary collapse

STRIP_REGEX =
{
  erb: /\<\%(.*?)\%\>/,
  handlebars: /\{\{(.*?)\}\}/
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Strip

Returns a new instance of Strip.



10
11
12
# File 'lib/code_reaper/strip.rb', line 10

def initialize str
  @str = str
end

Instance Attribute Details

#strObject (readonly)

Returns the value of attribute str.



3
4
5
# File 'lib/code_reaper/strip.rb', line 3

def str
  @str
end

Instance Method Details

#strip(regex) ⇒ Object



14
15
16
# File 'lib/code_reaper/strip.rb', line 14

def strip regex
  str.gsub filter(regex), ''
end