module Deface::Applicator

Public Instance Methods

compatible_with_end_selector?() click to toggle source
# File lib/deface/applicator.rb, line 91
def compatible_with_end_selector?
  create_action_command.range_compatible?
end
create_action_command() click to toggle source
# File lib/deface/applicator.rb, line 84
def create_action_command
  commands = Rails.application.config.deface.actions
  command = commands.find { |command| command.to_sym == action }
  raise(DefaceError, "Action #{action} not found") unless command
  command.new(:source_element => safe_source_element, :attributes => attributes)
end
execute_action(target_element) click to toggle source
# File lib/deface/applicator.rb, line 75
def execute_action(target_element)
  validate_original(target_element)
  create_action_command.execute(target_element)
end
execute_action_on_range(target_range) click to toggle source
# File lib/deface/applicator.rb, line 80
def execute_action_on_range(target_range)
  create_action_command.execute_on_range(target_range)
end
matcher() click to toggle source
# File lib/deface/applicator.rb, line 95
def matcher
  if end_selector.blank?
    Deface::Matchers::Element.new(selector) # single css selector
  else
    unless compatible_with_end_selector?
      raise Deface::NotSupportedError, ":#{action} action does not support :closing_selector"
    end
    # targeting range of elements as end_selector is present
    Deface::Matchers::Range.new(name, selector, end_selector)
  end
end