Class: Deface::Sources::Copy

Inherits:
Source
  • Object
show all
Defined in:
lib/deface/sources/copy.rb

Class Method Summary collapse

Methods inherited from Source

to_sym

Class Method Details

.execute(override) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/deface/sources/copy.rb', line 4

def self.execute(override)
  copy = override.args[:copy]
  if copy.is_a? Hash
    range = Deface::Matchers::Range.new('Copy', copy[:start], copy[:end]).matches(override.parsed_document).first
    Deface::Parser.undo_erb_markup! range.map(&:to_s).join
  else
    Deface::Parser.undo_erb_markup! override.parsed_document.css(copy).first.to_s.clone
  end
end