lib/fixy/record.rb
# Convenience method for creating field methods
Convenience method for creating field methods
Convenience method for creating field methods
def field_value(name, value)
        if (private_instance_methods + instance_methods).include?(name)
          raise ArgumentError, "Method '#{name}' is already defined, watch out for conflicts."
        end
        if value.is_a? Proc
          define_method(name) { self.instance_exec(&value) }
        else
          define_method(name) { value }
        end
      end
def field_value ( name , value ) if ( private_instance_methods + instance_methods ) . include? ( name ) raise ArgumentError , "Method '#{name}' is already defined, watch out for conflicts." end if value . is_a? Proc define_method ( name ) { self . instance_exec ( & value ) } else define_method ( name ) { value } end end
Convenience method for creating field methods
Convenience method for creating field methods
# Make sure we're not overriding an existing method
name
<not_specific>
value
<not_specific>