Skip to content

Commit

Permalink
Improve nil catching
Browse files Browse the repository at this point in the history
  • Loading branch information
therabidbanana committed Apr 15, 2012
1 parent f32f32c commit 382f680
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/eventbrite/api_object_class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def updatable_date(*args)
args.each{|symbol|

module_eval( "def #{symbol}(); Eventbrite.formatted_time(attribute_get(:#{symbol})); end")
module_eval( "def #{symbol}=(val, no_dirty = false); attribute_set(:#{symbol}, Time.parse(val), no_dirty) unless (val.nil? || val.empty?); end")
module_eval( "def #{symbol}=(val, no_dirty = false); attribute_set(:#{symbol}, Time.parse(val), no_dirty) unless (val.nil? || val.to_s.empty?); end")
}
end

Expand All @@ -80,7 +80,7 @@ def readable_date(*args)
args.each{|symbol|

module_eval( "def #{symbol}(); Eventbrite.formatted_time(attribute_get(:#{symbol})); end")
module_eval( "def #{symbol}=(val, no_dirty = false); attribute_set(:#{symbol}, Time.parse(val), true) unless (val.nil? || val.empty?); end")
module_eval( "def #{symbol}=(val, no_dirty = false); attribute_set(:#{symbol}, Time.parse(val), true) unless (val.nil? || val.to_s.empty?); end")
}
end

Expand Down

0 comments on commit 382f680

Please sign in to comment.