Sha256: e85b44ff7f99549a320530b7d6dac8f1525d011718152f1f477ae3ce28a72608

Contents?: true

Size: 453 Bytes

Versions: 5

Compression:

Stored size: 453 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)
        "\#{#{plain_path || plain}#{cast}}"
      end

      private

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pump-0.1.0 lib/pump/xml/value.rb
pump-0.0.5 lib/pump/xml/value.rb
pump-0.0.4 lib/pump/xml/value.rb
pump-0.0.3 lib/pump/xml/value.rb
pump-0.0.2 lib/pump/xml/value.rb