lib/glue/property.rb in glue-0.27.0 vs lib/glue/property.rb in glue-0.28.0

- old
+ new

@@ -1,14 +1,14 @@ -require 'mega/annotation' -require 'mega/inheritor' -require 'mega/dictionary' +require 'facet/annotation' +require 'facet/inheritor' +require 'facet/dictionary' require 'glue/on_included' -require 'og/entity' require 'glue/validation' -require 'og/relation/all' require 'glue/aspects' +require 'og/entity' +require 'og/relation/all' # A convienience structure that holds property # metadata. #-- # TODO: reimplement type checking. @@ -69,17 +69,23 @@ if values.has_key?(prop_name) prop_value = values[prop_name] - # to_s must be called on the prop_value incase the request is IOString + # to_s must be called on the prop_value incase the + # request is IOString. + prop_value = prop_value.to_s unless prop_value.is_a?(Hash) or prop_value.is_a?(Array) - # If property is a Blob dont overwrite current property's data if "". + # If property is a Blob dont overwrite current + # property's data if "". + break if prop.klass == Og::Blob and prop_value.empty? - # if custom preprocessing is active then try and preprocess + # If custom preprocessing is active then try and + # preprocess. + prop_value = preprocess_value(obj, prop, prop_value) if options[:preprocess] # assign using __force_ methods. obj.send("__force_#{prop_name}", prop_value) @@ -261,10 +267,10 @@ module_eval(code) end alias :property :prop_accessor - # NITRO specific!! leave blank in nano/mega. + # NITRO specific!! leave blank in facets. # TODO: factor in eval_helpers into the hook! def self.__add_prop_hook__(m) m.send(:include, Og::EntityMixin) unless m.ancestors.include?(Og::EntityMixin) m.send(:include, Glue::Validation) unless m.ancestors.include?(Glue::Validation)