From 52ca7110c3e53fd8b203ac873a688e3b2f6a5e69 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Tue, 19 Aug 2014 23:01:19 +0300 Subject: [PATCH] ad a preliminary syntax for class objects, which is just the class name --- lib/sof/writer.rb | 3 +++ test/sof.rb | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/sof/writer.rb b/lib/sof/writer.rb index 4a41c892..cec1104f 100644 --- a/lib/sof/writer.rb +++ b/lib/sof/writer.rb @@ -31,6 +31,9 @@ module Sof end def object_sof_node( object , level , ref) + if( object.is_a? Class ) + return SimpleNode.new( object.name ) + end head = object.class.name + "(" atts = attributes_for(object).inject({}) do |hash , a| val = get_value(object , a) diff --git a/test/sof.rb b/test/sof.rb index 30632626..faa77ab0 100644 --- a/test/sof.rb +++ b/test/sof.rb @@ -86,4 +86,8 @@ class BasicSof < MiniTest::Test @out = Sof::Writer.write(object) check "&1 ObjectWithAttributes(:name => 'some name', :number => 1234, :extra => *1)" end + def test_class + @out = Sof::Writer.write(ObjectWithAttributes) + check "ObjectWithAttributes" + end end \ No newline at end of file