lib/input_sanitizer/sanitizer.rb in input_sanitizer-0.1.9 vs lib/input_sanitizer/sanitizer.rb in input_sanitizer-0.1.10
- old
+ new
@@ -55,27 +55,15 @@
def self.inherited(subclass)
subclass.fields = self.fields.dup
end
- def self.string(*keys)
- set_keys_to_type(keys, :string)
- end
-
- def self.integer(*keys)
- set_keys_to_type(keys, :integer)
- end
-
- def self.boolean(*keys)
- set_keys_to_type(keys, :boolean)
- end
-
- def self.date(*keys)
- set_keys_to_type(keys, :date)
- end
-
- def self.time(*keys)
- set_keys_to_type(keys, :time)
+ converters.keys.each do |name|
+ class_eval <<-END
+ def self.#{name}(*keys)
+ set_keys_to_type(keys, :#{name})
+ end
+ END
end
def self.custom(*keys)
options = keys.pop
converter = options.delete(:converter)