Description
instead of params.foo
we should just say @foo
why?
- its 25 times faster
- its much more consistent - all component state is in instance vars regardless of how it is set
- the params wrapper method is not private (but it should be)
- less typing
- it just feels more natural to ruby.
Don't worry - you can get the legacy behavior by adding param_accessor_style :legacy
to any component (including the base component.) You can also say param_accessor_style :both
to get both behaviors. If you need to switch back to the now standard behavior say param_accessor_style :hyperstack
So for example you can say param_accessor_style :legacy
in your base component, and then as you update components to new style in that component say param_accessor_style :hyperstack
.
The param declaration macro is unchanged, but has a new alias
option.
param :foo, alias: :internal_name
If you like to distinguish between params and other instance variables you can use this feature like this:
param :foo, alias: :param_foo
for example
see #52 for a complete example