From f2c4e542ac2d2a58575281873cfc8f028ae00ca0 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 4 Jan 2017 21:32:09 +0200 Subject: [PATCH] rename to to array function to to_arr --- lib/register/instruction.rb | 4 ++-- lib/register/instructions/branch.rb | 4 ++-- lib/register/instructions/label.rb | 2 +- test/register/test_instructions.rb | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/register/instruction.rb b/lib/register/instruction.rb index 17b9ccff..58fd1d51 100644 --- a/lib/register/instruction.rb +++ b/lib/register/instruction.rb @@ -71,9 +71,9 @@ module Register ret end - def to_ac labels = [] + def to_arr labels = [] ret = [self.class] - ret += self.next.to_ac(labels) if self.next + ret += self.next.to_arr(labels) if self.next ret end diff --git a/lib/register/instructions/branch.rb b/lib/register/instructions/branch.rb index 170b8747..52a2f604 100644 --- a/lib/register/instructions/branch.rb +++ b/lib/register/instructions/branch.rb @@ -20,9 +20,9 @@ module Register ret end - def to_ac labels = [] + def to_arr( labels = [] ) ret = super(labels) - ret += self.label.to_ac(labels) if self.label + ret += self.label.to_arr(labels) if self.label ret end diff --git a/lib/register/instructions/label.rb b/lib/register/instructions/label.rb index e12277bc..ebee7a97 100644 --- a/lib/register/instructions/label.rb +++ b/lib/register/instructions/label.rb @@ -27,7 +27,7 @@ module Register @name.split(".").length == 2 end - def to_ac labels = [] + def to_arr labels = [] return [] if labels.include?(self) labels << self super diff --git a/test/register/test_instructions.rb b/test/register/test_instructions.rb index da9a949a..5d9f11eb 100644 --- a/test/register/test_instructions.rb +++ b/test/register/test_instructions.rb @@ -54,7 +54,7 @@ module Register @instruction.replace_next @label assert_equal @label, @instruction.last assert_equal @label, @instruction.next - assert_equal 2 , @instruction.length , @instruction.to_ac + assert_equal 2 , @instruction.length , @instruction.to_arr end def test_each_label1 @instruction.set_next @label