Ruby- Not all lines being loaded but no error?

66 Views Asked by At

I have this code:

    p "RC3"
    def self.rename_component
       # SOME CODE
    end

    def self.Rename(path,name)
       # SOME CODE
    end

    p "RC4"

    def self.Rename_And_Reposition_Components
      p "RC4.1"
      # SOME CODE
    end
    p "RC5"

Which outputs this:

"RC3"
"RC4"

When I have my code within #SOME CODE "RC5" doesn't print, but I also don't get any errors. Can anyone suggest what might be able to do to track down this silent error?

For completeness, the entire code block is:

https://pastebin.com/fj8tQzak

1

There are 1 best solutions below

2
Stefan On

The code (in your Pastebin) actually looks like this:

p "RC4"
def self.Rename_And_Reposition_Components()
  p "RC4.1"
  # ...
  for x in files do
    # ...
  end
  p "RC5"
  p "Loaded remaking components"
  # ...
end

Note that p "RC5" is still inside your Rename_And_Reposition_Components method's body.

Since the edited code in your question shows that line after the method, you are probably missing an end somewhere.