-
Notifications
You must be signed in to change notification settings - Fork 312
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
Default block doesn't recurse #26
Comments
Since h.foo is not a Hashie::Mash, it wouldn't use the block, if I understand correctly... |
I think this is a miscommunication. Mash is recursive by default right? When you inspect h.foo:
It's a Mash. However, the default block that was assigned to the parent isn't carried down. |
oh. yah, ignore me.... :P |
If any of you are interested in sending up a pull, I'd be happy to review it! |
I ran into a similar issue while subclassing a Hashie::Trash base class (properties were losing their :transform_with argument). I was using it to abstract requests to a really gnarly API. Solved it with an activesupport concern, works great. DATE = lambda {|v| v.stamp('12/31/1999')}
module DateRange
extend ActiveSupport::Concern
included do
property :start_date, :default => Date.today, :transform_with => DATE, :required => true
property :end_date, :default => Date.today, :transform_with => DATE, :required => true
end
end
class BaseRequest < Hashie::Trash
credentials = Hashie::Mash.new(YAML::load(File.read(File.join(ENV['HOME'], '.fuglyapi'))))
property :username, :default => credentials.username
property :password, :default => credentials.password
end
class OrderRequest < BaseRequest
extend ActiveSupport::Concern
property :criteria, :default => 'all'
property :campaign_id, :default => 'all'
end
class OrderIndexByDate < OrderRequest
include DateRange
end |
I am going to close this. Please reopen if you think we need to do something in Hashie for this. |
I believe that last line should throw an exception.
The text was updated successfully, but these errors were encountered: