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

Keyword arguments do not work in Ruby 1.9 #59

Closed
oshmyrko opened this issue Aug 21, 2015 · 9 comments
Closed

Keyword arguments do not work in Ruby 1.9 #59

oshmyrko opened this issue Aug 21, 2015 · 9 comments

Comments

@oshmyrko
Copy link

In this commit you've added new method and variable with keyword argument:

  def initialize(**args)
    Aws.config[:region] = args[:region] if args.key?(:region)
  end

  aws_cfn = AwsCfn.new(region: template.aws_region)

but keyword arguments work only with Ruby 2.0.
Does it mean that we should use cloudformation-ruby-dsl with Ruby 2.0 or it's just a mistake?

Thanks!

@jonaf
Copy link
Contributor

jonaf commented Aug 21, 2015

Hi @oshmyrko , good find! Looks like we either need to stop supporting Ruby 1.9, require Ruby 2.0, or fix this for backward compatibility with Ruby 1.9. I guess we should fix this to support Ruby 1.9. @temujin9 Any thoughts/preference on this? I don't think there's anything else that is incompatible with Ruby 1.9 ...

@temujin9
Copy link
Contributor

Let's keep Ruby 1.9 compatibility, at least for as long as it's simple to do so.

jonaf pushed a commit that referenced this issue Sep 1, 2015
@jonaf
Copy link
Contributor

jonaf commented Sep 1, 2015

Created #61 for this issue. @temujin9 care to take a quick look for me? Thanks.

@oshmyrko
Copy link
Author

oshmyrko commented Sep 2, 2015

Hi @jonaf,
I'm not well familiar with Ruby, but I have one more question.
Should this line also be changed - validate_params: false?
Seems this error is caused by that line:

/var/lib/gems/1.9.1/gems/cloudformation-ruby-dsl-1.0.3/lib/cloudformation-ruby-dsl/cfntemplate.rb:52: syntax error, unexpected keyword_end, expecting $end
    from ./logstash.rb:4:in `<main>'

Thanks!

@jonaf
Copy link
Contributor

jonaf commented Sep 2, 2015

@oshmyrko I didn't get this error in Ruby 1.9.3-p551_1. What version of Ruby are you running? This error is due to the trailing comma, which is a preferred code style and acceptable in most places in most versions of Ruby (apparently, 1.9.1 doesn't like the trailing comma in method parameters?).

@oshmyrko
Copy link
Author

oshmyrko commented Sep 2, 2015

I'm using Ruby 1.9.3p484:

$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

$ gem which cloudformation-ruby-dsl
/var/lib/gems/1.9.1/gems/cloudformation-ruby-dsl-1.0.3/lib/cloudformation-ruby-dsl.rb

@jonaf
Copy link
Contributor

jonaf commented Sep 2, 2015

That's odd ... Why does gem indicate you have cloudformation-ruby-dsl installed for ruby 1.9.1, but your version of Ruby is 1.9.3?

@oshmyrko
Copy link
Author

oshmyrko commented Sep 2, 2015

Found this - Why are we installing Ruby 1.9.2/1.9.3 gems into a 1.9.1 folder?, and this.

In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.
Gems that compile to native code had to be recompiled.
The interface was again changed in Ruby 1.9.1 and kept the same in Ruby 1.9.2 & 3. This explains the 1.9.1 you are seeing in your path.

Seems it is normal.

jonaf pushed a commit that referenced this issue Sep 9, 2015
@jonaf jonaf closed this as completed in 24d8e68 Sep 9, 2015
@oshmyrko
Copy link
Author

Thank you @jonaf,
it is working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants