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

Simple type fixes and method change #820

Merged
merged 2 commits into from
May 20, 2015

Conversation

alkesh26
Copy link
Contributor

  1. aws.rb
    Instead of !array.include?() we can use exclude more readable. Benchmarked these methods. The result is same almost.

  2. customizer.rb
    Since shape_name is not used we can use each_value.

  3. parse.rb
    This can be initialised to empty array and hash.

    Rest all files are simple typo fixes.

1. aws.rb
    Instead of !array.include?() we can use exclude more readable. Benchmarked these methods. The result is same almost.
2. customizer.rb
    Since shape_name is not used we can use each_value.
3. parse.rb
    This can be initialized to empty array and hash. Does setting nil in method call make some memory manipulation.

    Rest all files are simple typo fixes.
@trevorrowe
Copy link
Member

I responded with a pull request to your fork here: alkesh26#1 - This addresses the parser errors. The root cause is that a nil value is being passed into the #list and #map methods preventing the defaults to setup from being used. Instead, nil values are used which don't respond to #[]= or #<<.

If you merge those changes, I'll be happy to these these.

@alkesh26
Copy link
Contributor Author

@trevorrowe I am very thankful for your response. Can you please help me more in understanding the error. May be with an example or some link. I am unable to identify the root cause.

It will be of great help. And thanks a lot once again. Your comment made my day. :)

@trevorrowe
Copy link
Member

Sure thing. When defining a Ruby method with a default value, that value is only used when the agument is not given. For example:

def example(value = "default-value")
  value
end

example
#=> "example-value"

example(nil)
#=> nil

The JSON parser was always passing the target parameter. This prevented the default values of [] and {} from ever being used. The patch I sent to your branch modified the parser to not send nil values. The fix above also resolves this.

trevorrowe added a commit that referenced this pull request May 20, 2015
@trevorrowe trevorrowe merged commit 7b3f652 into aws:master May 20, 2015
@trevorrowe
Copy link
Member

Thanks for the contribution!

@alkesh26 alkesh26 deleted the typo_fixing_and_code_changes branch January 4, 2019 12:34
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

Successfully merging this pull request may close these issues.

2 participants