Sha256: 4196d8e213463b2ef4a55099bc5c771ee107ede131557e0d606d36e529e20757

Contents?: true

Size: 1.61 KB

Versions: 562

Compression:

Stored size: 1.61 KB

Contents

module Nokogiri
  module XML
    module PP
      module Node
        def inspect # :nodoc:
          attributes = inspect_attributes.reject { |x|
            begin
              attribute = send x
              !attribute || (attribute.respond_to?(:empty?) && attribute.empty?)
            rescue NoMethodError
              true
            end
          }.map { |attribute|
            "#{attribute.to_s.sub(/_\w+/, 's')}=#{send(attribute).inspect}"
          }.join ' '
          "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>"
        end

        def pretty_print pp # :nodoc:
          nice_name = self.class.name.split('::').last
          pp.group(2, "#(#{nice_name}:#{sprintf("0x%x", object_id)} {", '})') do

            pp.breakable
            attrs = inspect_attributes.map { |t|
              [t, send(t)] if respond_to?(t)
            }.compact.find_all { |x|
              if x.last
                if [:attribute_nodes, :children].include? x.first
                  !x.last.empty?
                else
                  true
                end
              end
            }

            pp.seplist(attrs) do |v|
              if [:attribute_nodes, :children].include? v.first
                pp.group(2, "#{v.first.to_s.sub(/_\w+$/, 's')} = [", "]") do
                  pp.breakable
                  pp.seplist(v.last) do |item|
                    pp.pp item
                  end
                end
              else
                pp.text "#{v.first} = "
                pp.pp v.last
              end
            end
            pp.breakable

          end
        end
      end
    end
  end
end

Version data entries

562 entries across 533 versions & 51 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.9 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.6 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.5 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.5 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node 2.rb
video_chat_get-0.1.5 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node 3.rb
video_chat_get-0.1.4 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/nokogiri-1.10.10/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.3 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.2 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.1 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
video_chat_get-0.1.0 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/lib/nokogiri/xml/pp/node.rb
nokogiri-1.10.10 lib/nokogiri/xml/pp/node.rb