lib/attributor.rb in attributor-2.6.1 vs lib/attributor.rb in attributor-3.0

- old
+ new

@@ -12,11 +12,11 @@ require_relative 'attributor/type' require_relative 'attributor/dsl_compiler' require_relative 'attributor/attribute_resolver' require_relative 'attributor/example_mixin' - + require_relative 'attributor/extensions/randexp' # hierarchical separator string for composing human readable attributes SEPARATOR = '.'.freeze @@ -43,20 +43,20 @@ klass end def self.humanize_context( context ) - raise "NIL CONTEXT PASSED TO HUMANZE!!" unless context + return "" unless context if context.kind_of? ::String context = Array(context) end unless context.is_a? Enumerable - raise "INVALID CONTEXT!!! (got: #{context.inspect})" + raise "INVALID CONTEXT!!! (got: #{context.inspect})" end - + begin return context.join('.') rescue Exception => e raise "Error creating context string: #{e.message}" end @@ -71,14 +71,14 @@ MODULE_PREFIX = "Attributor\:\:".freeze MODULE_PREFIX_REGEX = Regexp.new(MODULE_PREFIX) require_relative 'attributor/families/numeric' require_relative 'attributor/families/temporal' - + require_relative 'attributor/types/container' require_relative 'attributor/types/object' - + require_relative 'attributor/types/bigdecimal' require_relative 'attributor/types/integer' require_relative 'attributor/types/string' require_relative 'attributor/types/symbol' require_relative 'attributor/types/boolean' @@ -88,15 +88,16 @@ require_relative 'attributor/types/float' require_relative 'attributor/types/collection' require_relative 'attributor/types/hash' require_relative 'attributor/types/model' require_relative 'attributor/types/struct' - + require_relative 'attributor/types/csv' require_relative 'attributor/types/ids' # TODO: move these to 'optional types' or 'extra types'... location require_relative 'attributor/types/tempfile' require_relative 'attributor/types/file_upload' + require_relative 'attributor/types/uri' end