CCramer CCramer - 1 year ago 69
Ruby Question

Ruby mystery syntax error

I'm new to Ruby so I'm afraid this is a dumb question, but I just cannot figure out why I'm getting this error:

init.rb: C:/Users/dmpk/Desktop/warranty-pro/lib/guide.rb:2: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)

Here is a sample of the file in question

require 'claim'

class Guide

class Config
@@actions = ['add', 'list', 'find', 'quit']

def self.actions

The first line in the example above is line 1, the last line is line 10.
So it says it was expecting 'end' on line 2, and I don't understand why.

Answer Source

In case anybody comes across this question later, I fixed the issue. All I did was copy all the code in the file, delete the file, then make a new file with the same name and paste all the code in. After that it worked. So...I don't really know what the actual problem was, but it's fixed now!