lib/volt/controllers/reactive_accessors.rb
# Create a method to read a reactive value from an instance value.  If it
# is not setup, create it so it can be updated through the reactive value
# at a later point.
Create a method to read a reactive value from an instance value.  If it
is not setup, create it so it can be updated through the reactive value
at a later point.
Create a method to read a reactive value from an instance value . If it is not setup create it so it can be updated through the reactive value at a later point .
def reactive_writer(*names)
      names.each do |name|
        var_name = :"@#{name}"
        define_method(:"#{name}=") do |new_value|
          value = instance_variable_get(var_name)
          if value
            value.cur = new_value
          else
            instance_variable_set(var_name, ReactiveValue.new(value))
          end
        end
      end
    end
def reactive_writer ( * names ) names . each do | name | var_name = :" @ #{ name } " define_method ( :" #{ name } = " ) do | new_value | value = instance_variable_get ( var_name ) if value value . cur = new_value else instance_variable_set ( var_name , ReactiveValue . new ( value ) ) end end end end
Create a method to read a reactive value from an instance value.
Create a method to read a reactive value from an instance value .
names