lib/active_fields/config.rb in active_fields-0.2.0 vs lib/active_fields/config.rb in active_fields-1.0.0

- old
+ new

@@ -5,19 +5,22 @@ DEFAULT_FIELD_BASE_CLASS_NAME = "ActiveFields::Field::Base" DEFAULT_VALUE_CLASS_NAME = "ActiveFields::Value" include Singleton - attr_accessor :field_base_class_name, :value_class_name, :fields + attr_accessor :field_base_class_name, :value_class_name + attr_reader :fields def initialize @field_base_class_name = DEFAULT_FIELD_BASE_CLASS_NAME @value_class_name = DEFAULT_VALUE_CLASS_NAME @fields = { boolean: "ActiveFields::Field::Boolean", date: "ActiveFields::Field::Date", date_array: "ActiveFields::Field::DateArray", + datetime: "ActiveFields::Field::DateTime", + datetime_array: "ActiveFields::Field::DateTimeArray", decimal: "ActiveFields::Field::Decimal", decimal_array: "ActiveFields::Field::DecimalArray", enum: "ActiveFields::Field::Enum", enum_array: "ActiveFields::Field::EnumArray", integer: "ActiveFields::Field::Integer", @@ -43,8 +46,16 @@ value_class_name != DEFAULT_VALUE_CLASS_NAME end def register_field(type_name, class_name) @fields[type_name.to_sym] = class_name + end + + def type_names + fields.keys + end + + def type_class_names + fields.values end end end