lib/dm-is-reflective/is/reflective.rb in dm-is-reflective-1.0.1 vs lib/dm-is-reflective/is/reflective.rb in dm-is-reflective-1.1.0
- old
+ new
@@ -13,11 +13,11 @@
# DataMapper.repository.adapter.fields storage_name
def fields repo = default_repository_name
DataMapper.repository(repo).adapter.fields(storage_name(repo))
end
- # it automaticly creates reflection from storage fields to properties.
+ # it automatically creates reflection from storage fields to properties.
# i.e. you don't have to specify any property if you are connecting
# to an existing database.
# you can pass it Regexp to map any field it matched, or just
# the field name in Symbol or String, or a Class telling it
# map any field which type equals to the Class.
@@ -47,11 +47,11 @@
# reflect :login, Integer
# end
def reflect *targets
targets << /.*/ if targets.empty?
- fields.map{ |field|
+ result = fields.map{ |field|
name, type, attrs = field
reflected = targets.each{ |target|
case target
when Regexp;
@@ -68,9 +68,12 @@
end
}
property(reflected, type, attrs) if reflected.kind_of?(Symbol)
}.compact
+
+ finalize if respond_to?(:finalize)
+ result
end
end # of ClassMethod
end # of Reflective
end # of Is