From c1de10352d8af105fe532008ceafcdd30b5fbdab Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 27 Sep 2017 16:44:07 +0300 Subject: [PATCH] add to_rxf to object --- lib/rx-file.rb | 5 +++++ test/helper.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/rx-file.rb b/lib/rx-file.rb index 23ebbf8..a52ea21 100644 --- a/lib/rx-file.rb +++ b/lib/rx-file.rb @@ -13,6 +13,11 @@ require_relative "rx-file/array_node" require_relative "rx-file/hash_node" require_relative "rx-file/occurence" +Object.class_eval do + def to_rxf + RxFile.write(self) + end +end Class.class_eval do def to_rxf self.name diff --git a/test/helper.rb b/test/helper.rb index 5454f66..a269bbf 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -13,7 +13,7 @@ require 'rx-file' module Checker def check should - out = RxFile.write(@out) + out = @out.to_rxf same = (should == out) puts "Shouldda\n#{out}" unless same assert_equal should , out