Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6928

Re: I need help understanding some code..

Newsgroups comp.lang.ruby
Date 2014-03-05 13:07 -0800
References <201e9c0c-0723-49b1-8021-a72d7caf0987@googlegroups.com>
Message-ID <9244258a-8dc0-42da-be4f-6c08eae80484@googlegroups.com> (permalink)
Subject Re: I need help understanding some code..
From Thomas Foster <thomas.foster80@gmail.com>

Show all headers | View raw


On Wednesday, March 5, 2014 2:55:05 PM UTC-5, Thomas Foster wrote:
> I am new to ruby, but have been writing some code to understand it better.  I am writing this post because I need some help with determining where SystemStackError is located...I am trying to use a ruby library to automate building vms in vmware an I see this error everytime I run the code.
> 
> 
> 
> /usr/local/rvm/gems/ruby-1.9.3 p545/gems/fog-.20.0/lib/fog/core/collection.rb stack level too deep (SystemStackError)
> 
> 
> 
> 
> 
> Here is the line that generates the error and I am trying to see if I can resolve this problem (with the help of you guys).  I appreciate any help..Hopefully you can point me in the right direction so I can try and fix this problem.
> 
> 
> 
> def inspect
> 
>       Thread.current[:formatador] ||= Formatador.new
> 
>       data = "#{Thread.current[:formatador].indentation}<#{self.class.name}\n"
> 
>       Thread.current[:formatador].indent do
> 
>         unless self.class.attributes.empty?
> 
>           data << "#{Thread.current[:formatador].indentation}"
> 
>           data << self.class.attributes.map {|attribute| "#{attribute}=#{send(attribute).inspect}"}.join(",\n#{Thread.current[:formatador].indentation}")
> 
>           data << "\n"
> 
>         end
> 
>         data << "#{Thread.current[:formatador].indentation}["
> 
>         unless self.empty?
> 
>           data << "\n"
> 
>           Thread.current[:formatador].indent do
> 
>             data << self.map {|member| member.inspect}.join(",\n")
> 
>             data << "\n"
> 
>           end
> 
>           data << Thread.current[:formatador].indentation
> 
>         end
> 
>         data << "]\n"
> 
>       end
> 
>       data << "#{Thread.current[:formatador].indentation}>"
> 
>       data
> 
>     end
> 
> 
> 
> 
> 
> If you need more info, please let me know.



After reading a few posts around the google machine..I think I found the issue was with the inspect function and the existing inspect method implemented in ruby...When I changed the def inspect line to def inspects..the issue was resolved..I don't know what else it broke :) but I am able to access my objects in VSphere 5.1.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

I need help understanding some code.. Thomas Foster <thomas.foster80@gmail.com> - 2014-03-05 11:55 -0800
  Re: I need help understanding some code.. Thomas Foster <thomas.foster80@gmail.com> - 2014-03-05 11:56 -0800
  Re: I need help understanding some code.. Thomas Foster <thomas.foster80@gmail.com> - 2014-03-05 13:07 -0800
    Re: I need help understanding some code.. Robert Klemme <shortcutter@googlemail.com> - 2014-03-07 08:43 +0100

csiph-web