Sha256: 5a09eb3f4e25f1f01e8f719032da347f3740c2f7b44e105cf2ba7415a75cdab6

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 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
    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.2.1 lib/arachni/element/capabilities/with_dom.rb
arachni-1.2 lib/arachni/element/capabilities/with_dom.rb
arachni-1.1 lib/arachni/element/capabilities/with_dom.rb