Sha256: 39d528ba3022eb8dbbce5ae16f24c659858fec7c3735cd4d45d8779e04df6189

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

=begin
    Copyright 2010-2015 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

module Arachni
module Element::Capabilities

# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
module WithDOM

    # @return     [DOM]
    attr_accessor :dom

    # @return     [Bool, nil]
    #   Force {#dom} to return `nil` -- used as an audit optimization.
    attr_accessor :skip_dom

    # @return   [DOM]
    def dom
        return if skip_dom?
        @dom ||= self.class::DOM.new( parent: self )
    rescue Inputtable::Error => e
        print_debug_exception e
        nil
    end

    def skip_dom=( bool )
        @dom      = nil if bool
        @skip_dom = bool
    end

    def skip_dom?
        !!@skip_dom
    end

    def dup
        copy_with_dom( super )
    end

    private

    def copy_with_dom( other )
        other.dom      = @dom.dup.tap { |d| d.parent = other } if @dom
        other.skip_dom = @skip_dom
        other
    end

end

end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arachni-1.3.2 lib/arachni/element/capabilities/with_dom.rb
arachni-1.3.1 lib/arachni/element/capabilities/with_dom.rb
arachni-1.3 lib/arachni/element/capabilities/with_dom.rb