Permalink
Browse files

whitespace fixes

  • Loading branch information...
mustmodify committed Oct 17, 2017
1 parent 4f77973 commit 90f70a043f68603a68db6e6c375ecd7455741f29
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/valuable/utils.rb
@@ -38,7 +38,7 @@ def format( name, value, attributes, collection_item = false )
klass = collection_item ? attributes[name][:item_klass] : attributes[name][:klass]
case klass
when *formatters.keys
when *formatters.keys
formatters[klass].call(value)
when NilClass
@@ -81,15 +81,15 @@ def format( name, value, attributes, collection_item = false )
else
BigDecimal.new( value.to_s )
end
when :string
value && value.to_s
when :boolean
value == '0' ? false : !!value
else
if value.nil?
@@ -105,11 +105,11 @@ def format( name, value, attributes, collection_item = false )
end unless value.nil?
end
def formatters
@formatters ||= {}
end
def klass_options
[NilClass, :integer, Class, :date, :decimal, :string, :boolean] + formatters.keys
end
@@ -133,7 +133,7 @@ def check_options_validity( class_name, attribute, options )
raise ArgumentError, "#{class_name}##{attribute} has a default value that must be set using a lambda. Use :default => lambda { Thing.new }." if options[:default] && !options[:default].kind_of?(Proc) && !can_be_duplicated?( options[:default] )
raise ArgumentError, "has_value did not know how to respond to option(s) #{invalid_options.join(', ')}. Valid (optional) arguments are: #{known_options.join(', ')}" unless invalid_options.empty?
raise ArgumentError, "has_value did not know how to respond to option(s) #{invalid_options.join(', ')}. Valid (optional) arguments are: #{known_options.join(', ')}" unless invalid_options.empty?
raise ArgumentError, "#{class_name} doesn't know how to format #{attribute} with :klass => #{options[:klass].inspect}" unless klass_options.any?{|klass| klass === options[:klass]}

0 comments on commit 90f70a0

Please sign in to comment.