@@ -48,21 +48,23 @@ def param_definitions
4848 end
4949
5050 def define_param ( name , param_type , aka = nil )
51- meth_name = aka || name
52- var_name = fix_suffix ( aka ) || instance_var_name_for ( name )
53- param_definitions [ name ] = lambda do |props |
54- @component . instance_variable_set :"@#{ var_name } " , val = fetch_from_cache ( name , param_type , props )
55- next unless param_accessor_style == :accessors
56- `#{ @component } [#{ "$#{ meth_name } " } ] = function() { return #{ val } }`
57- # @component.define_singleton_method(name) { val } if param_accessor_style == :accessors
51+ if param_accessor_style != :legacy || aka
52+ meth_name = aka || name
53+ var_name = fix_suffix ( aka ) || instance_var_name_for ( name )
54+ param_definitions [ name ] = lambda do |props |
55+ @component . instance_variable_set :"@#{ var_name } " , val = fetch_from_cache ( name , param_type , props )
56+ next unless param_accessor_style == :accessors
57+ `#{ @component } [#{ "$#{ meth_name } " } ] = function() { return #{ val } }`
58+ # @component.define_singleton_method(name) { val } if param_accessor_style == :accessors
59+ end
60+ return if %i[ hyperstack accessors ] . include? param_accessor_style
5861 end
59- return if %i[ hyperstack accessors ] . include? param_accessor_style
6062 if param_type == Proc
61- define_method ( meth_name . to_sym ) do |*args , &block |
63+ define_method ( name . to_sym ) do |*args , &block |
6264 props [ name ] . call ( *args , &block ) if props [ name ]
6365 end
6466 else
65- define_method ( meth_name . to_sym ) do
67+ define_method ( name . to_sym ) do
6668 fetch_from_cache ( name , param_type , props )
6769 end
6870 end
@@ -88,7 +90,7 @@ def param_accessor_style
8890
8991 def initialize ( component , incoming = nil )
9092 @component = component
91- return if param_accessor_style == :legacy
93+ # return if param_accessor_style == :legacy
9294 self . class . param_definitions . each_value do |initializer |
9395 instance_exec ( incoming || props , &initializer )
9496 end
0 commit comments