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

fix params.inspect for document format. use Hash and Proc soucify. #3

Merged
merged 3 commits into from
May 24, 2012

Conversation

joker1007
Copy link
Collaborator

In case document format,
Hash inspection is easier to see name & value combination.

and, In case I give Proc object to parameters,
sourcify Proc object for readability

In case document format,
Hash inspection is easier to see name & value combination.

and, In case I give Proc object to parameters,
sourcify Proc object for readability
@joker1007
Copy link
Collaborator Author

About document format

Sorry. I was lazy to think about document format.
prefererd format is like following:

a: 1, b: 2, c: 3

The code is following:

pretty_params = [arg_names, params].transpose
  .map {|t| "#{t[0].to_s}: #{param_inspect(t[1])}"}.join(", ")
describe(pretty_params, *args) do

# ...

def param_inspect(obj)
  obj.class == Proc ? obj.to_raw_source : obj.inspect
end

I want to use custom format in the future.

About Proc inspection.

I also prefer later code.
I agree with to_raw_source.

tomykaira added a commit that referenced this pull request May 24, 2012
Use 1.9 hash like format for each describe's document
@tomykaira tomykaira merged commit 9d06bc9 into tomykaira:master May 24, 2012
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