Sha256: b934027fc949b442d8dfe5852256c9193679d86f888304caab38f9014b41b221

Contents?: true

Size: 662 Bytes

Versions: 3

Compression:

Stored size: 662 Bytes

Contents

module Dozuki
  module Parsers
    module String
      def self.parse(node)
        node.text.strip
      end
    end
    module Integer
      def self.parse(node)
        string = String.parse(node)
        begin
          Integer(string)
        rescue ArgumentError
          raise InvalidFormat.new(:node => node, :value => string, :format => "integer")
        end
      end
    end
    module Float
      def self.parse(node)
        string = String.parse(node)
        begin
          Float(string)
        rescue ArgumentError
          raise InvalidFormat.new(:node => node, :value => string, :format => "float")
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dozuki-0.2.0 lib/dozuki/parsers.rb
dozuki-0.1.0 lib/dozuki/parsers.rb
dozuki-0.0.3 lib/dozuki/parsers.rb