X-Git-Url: http://git.code-monkey.de/?p=ruby-eet.git;a=blobdiff_plain;f=lib%2Feet.rb;h=3976032d12bf25852f925d6dca2e25eb61a1beb9;hp=194409e4df9cbe8bf191f86e2812ee7f0adb2459;hb=6289e751f9a1a7c0a46345503da94f64426a71fe;hpb=b6055f83ebf477b190ce22ca0da6c4c4023aca4a diff --git a/lib/eet.rb b/lib/eet.rb index 194409e..3976032 100644 --- a/lib/eet.rb +++ b/lib/eet.rb @@ -1,5 +1,5 @@ #-- -# $Id: eet.rb 47 2005-05-30 19:19:07Z tilman $ +# $Id: eet.rb 49 2005-05-30 19:52:36Z tilman $ # # Copyright (c) 2005 Tilman Sauerbeck (tilman at code-monkey de) # @@ -25,40 +25,6 @@ require "eet_ext" class Object - # :call-seq: - # object.to_eet -> string - # - # Serializes the receiver to EET format. - def to_eet - props = to_eet_properties - - unless props.is_a?(Hash) && !props.empty? - raise(Eet::PropertyError, "invalid EET properties") - end - - eet_name = to_eet_name - - if eet_name.to_str.length < 1 || eet_name.to_str.include?(0) - raise(Eet::NameError, "invalid EET name") - end - - stream = Eet::Stream.new - - props.each_pair do |tag, arg| - unless arg.is_a?(Array) - raise(Eet::PropertyError, "hash value is not an array") - end - - value, type = arg - next if value.nil? - - stream.push(*value.to_eet_chunks(tag, type)) - end - - chunk = Eet::Chunk.new(eet_name, stream.serialize) - Eet::Stream.new(chunk).serialize - end - def to_eet_chunks(tag, type = nil) # :nodoc: [Eet::Chunk.new(tag, to_eet)] end @@ -156,9 +122,6 @@ end module Eet VERSION = "0.1.2" - class EetError < StandardError; end - class NameError < EetError; end - class PropertyError < EetError; end class ChunkError < EetError; end class Stream # :nodoc: