Explicit slot declaration
-
Yurii Rashkovskii
- Assigned user set to Yurii Rashkovskii
-
Sean Ouimet
Explicit slot declaration is similar to validates_type_of + validates_presence_of, except default values are not accounted for.
Some shortcut commands could make it easier to assign defaults or limit access when needed.
Member = StrokeDB::Meta.new do #allow only these slots #presumably existing slot types could still be used available_slots 'name', 'email', 'age' #assign default values if not defined #if no default value listed with key, nil is assumed #(so :age would be :age=>nil) default_slots :age, :status=>"newbie" #Allow no more slot types to be added (works well with above defaults setting nil first -- or could be based on all docs using the Meta). #My issues with this is it would make adding a new slot type (intentionally) more difficult (impossible?), whereas available_slots could be added to. freeze_slots end -
Justin Reagor
- Tag set to @idea, meta
This would look even better if it resembled DataMapper's DataMapper::Resource::ClassMethods "property" method... something like this:
Member = StrokeDB::Meta.new do
slot :name # no default for variable storage
slot :age, :default => 'newbie'
slots.freeze!
end
There's no reason for StrokeDB to state primitives upon initialization is there? Since pretty much any value should be able to be stored in any slot?
Just a quick question and suggestion... ;)
-
Lisa Bowman
This is what I'd love to know more about. Thank you so much for bringing this up! Hey if you're looking for furniture online you can check out ashley furniture. They have good designs or you can try genie guessing game if you're bored at home.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.