class ActiveModel::Validations::AcceptanceValidator::AttributeDefinition
def convert_to_reader_name(method_name)
def convert_to_reader_name(method_name) method_name.to_s.chomp("=") end
def define_on(klass)
def define_on(klass) attr_readers = attributes.reject { |name| klass.attribute_method?(name) } attr_writers = attributes.reject { |name| klass.attribute_method?("#{name}=") } klass.send(:attr_reader, *attr_readers) klass.send(:attr_writer, *attr_writers) end
def initialize(attributes)
def initialize(attributes) @attributes = attributes.map(&:to_s) end
def matches?(method_name)
def matches?(method_name) attr_name = convert_to_reader_name(method_name) attributes.include?(attr_name) end