lib/dynamoid/fields/declare.rb in dynamoid-3.9.0 vs lib/dynamoid/fields/declare.rb in dynamoid-3.10.0

- old
+ new

@@ -46,21 +46,21 @@ # only local variable is visible in `module_eval` block name = @name @source.generated_methods.module_eval do define_method(name) { read_attribute(name) } - define_method("#{name}?") do + define_method(:"#{name}?") do value = read_attribute(name) case value when true then true when false, nil then false else !value.nil? end end - define_method("#{name}=") { |value| write_attribute(name, value) } - define_method("#{name}_before_type_cast") { read_attribute_before_type_cast(name) } + define_method(:"#{name}=") { |value| write_attribute(name, value) } + define_method(:"#{name}_before_type_cast") { read_attribute_before_type_cast(name) } end end def generate_instance_methods_for_alias # only local variable is visible in `module_eval` block @@ -68,12 +68,12 @@ alias_name = @options[:alias].to_sym @source.generated_methods.module_eval do alias_method alias_name, name - alias_method "#{alias_name}=", "#{name}=" - alias_method "#{alias_name}?", "#{name}?" - alias_method "#{alias_name}_before_type_cast", "#{name}_before_type_cast" + alias_method :"#{alias_name}=", :"#{name}=" + alias_method :"#{alias_name}?", :"#{name}?" + alias_method :"#{alias_name}_before_type_cast", :"#{name}_before_type_cast" end end def warn_if_method_exists(method) if @source.instance_methods.include?(method.to_sym)