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

Add block-style hash 'Blash' #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ryansouza
Copy link
Contributor

Just an idea I was kicking around for a blocky style to creating sub-hashes, similar(if you squint) to Somethingfile-style configuration dsls.

blash = Blash.new
blash.author do |a|
  a.name = "Michael Bleigh"
end
blash.author # => <Blash name="Michael Bleigh">
blash.author.name # => "Michael Bleigh"

Also considered including the ability for the method calls that take the block to also take a single argument, which would craft another level of sub hash, like so

b = Blash.new

b.test :one do |one|
  one.foo = "bar"
end
b.test :two do |two|
  two.hurp = "derp"
end

b.test.one.foo # => "bar"
b.test.two.hurp # => "derp"

@johnbellone
Copy link

+1 here.

@dblock
Copy link
Member

dblock commented Mar 30, 2014

I'm taking over Hashie. I'd like to merge this. Can you please merge from upstream and update CHANGELOG? I'll give this a careful read. Thanks and sorry for the delay.

@bartoszkopinski
Copy link
Member

It's nice but it introduces a lot of duplication in code and behaviour with Mash.
I'd like to implement this into Mash or as an extension to MethodAccess.

What are your thoughts?

@dblock
Copy link
Member

dblock commented Apr 6, 2014

After looking at this I am with @bartoszkopinski.

@ryansouza
Copy link
Contributor Author

Makes sense to me 👍

I've got a lot on my plate right now, don't think I'll have time to work on this for a bit. If anybody wants to take the Mashie extension idea and roll with it, feel free.

@dblock
Copy link
Member

dblock commented Jul 6, 2014

Bump.

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.

None yet

4 participants