Sha256: a4a5dbf6f7544c6032eaa67cc1b9a3da89ded95236f58a66c0e270532edb9326

Contents?: true

Size: 586 Bytes

Versions: 8

Compression:

Stored size: 586 Bytes

Contents

require 'pump/xml/node'

module Pump
  class Xml
    class Value < Node
      attr_accessor :options

      def plain
        "object.#{name}"
      end

      def to_s(plain_path=nil)
        "\#{#{remove_ilegal_chars}#{plain_path || plain}#{cast}}"
      end

      private

      def cast
        if options[:typecast]
          ".#{options[:typecast]}"
        elsif !options[:xmlsafe]
          '.to_s.encode(:xml => :text)'
        end
      end

      def remove_ilegal_chars
        "remove_ilegal_chars " if !options[:typecast] && !options[:xmlsafe]
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pump-0.11.0 lib/pump/xml/value.rb
pump-0.10.0 lib/pump/xml/value.rb
pump-0.9.1 lib/pump/xml/value.rb
pump-0.9.0 lib/pump/xml/value.rb
pump-0.8.0 lib/pump/xml/value.rb
pump-0.7.0 lib/pump/xml/value.rb
pump-0.6.6 lib/pump/xml/value.rb
pump-0.6.5 lib/pump/xml/value.rb