Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load error with 0.0.6 on OS/X? #2

Open
william-stearns opened this issue Feb 12, 2013 · 0 comments
Open

Load error with 0.0.6 on OS/X? #2

william-stearns opened this issue Feb 12, 2013 · 0 comments

Comments

@william-stearns
Copy link

I'm trying to load a ruby library on my mac.  The "sudo gem install rb-blink1" works fine, but when I go to load it:

require 'blink1'
SyntaxError: /Library/Ruby/Gems/1.8/gems/rb-blink1-0.0.6/lib/blink1.rb:136: odd number list for Hash
id: i,
^
/Library/Ruby/Gems/1.8/gems/rb-blink1-0.0.6/lib/blink1.rb:136: syntax error, unexpected ':', expecting '}'
id: i,
^
/Library/Ruby/Gems/1.8/gems/rb-blink1-0.0.6/lib/blink1.rb:137: syntax error, unexpected ':', expecting '='
serial: cached_serial(i),
^
/Library/Ruby/Gems/1.8/gems/rb-blink1-0.0.6/lib/blink1.rb:137: syntax error, unexpected ',', expecting kEND
/Library/Ruby/Gems/1.8/gems/rb-blink1-0.0.6/lib/blink1.rb:139: syntax error, unexpected '}', expecting kEND

Here's the function from the original library:

def self.list
count = enumerate_vid_pid(vendor_id, product_id)
i = 0
devs = []
while i < count do
devs << {
id: i,
serial: cached_serial(i),
path: cached_path(i)
}
i += 1
end
devs
end

I replaced the colons between the keys and values with "=>" 's to look like this:

def self.list
count = enumerate_vid_pid(vendor_id, product_id)
i = 0
devs = []
while i < count do
devs << {
id=>i,
serial=>cached_serial(i),
path=>cached_path(i)
}
i += 1
end
devs
end

Now the library loads and runs just fine.
Is the "key: value" a deprecated syntax?  Too new for for my ruby?

ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]

ngs added a commit that referenced this issue Feb 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant