Permalink
Browse files

no need to check for nil

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent ea14396 commit f527f9097b20d4c6178bcdd70a2be11a129bc866 Neeraj Singh committed with spastorino Oct 17, 2010
@@ -85,7 +85,7 @@ def read_attribute(attr_name)
def _read_attribute(attr_name)
attr_name = attr_name.to_s
attr_name = self.class.primary_key if attr_name == 'id'
- if !(value = @attributes[attr_name]).nil?
+ if (value = @attributes[attr_name])
@andreacampi
andreacampi Oct 18, 2010 Contributor

Nitpicking: parenthesis are not needed here now, and given that they are not used on the next line they sort of stick out.

@andreacampi
andreacampi Oct 18, 2010 Contributor

Sorry, should have seen the next commit :)

if column = column_for_attribute(attr_name)
if unserializable_attribute?(attr_name, column)
unserialize_attribute(attr_name)
@@ -114,9 +114,9 @@ def table(table, stream)
column.type.to_s
end
spec[:limit] = column.limit.inspect if column.limit != @types[column.type][:limit] && spec[:type] != 'decimal'
- spec[:precision] = column.precision.inspect if !column.precision.nil?
- spec[:scale] = column.scale.inspect if !column.scale.nil?
- spec[:null] = 'false' if !column.null
+ spec[:precision] = column.precision.inspect if column.precision
+ spec[:scale] = column.scale.inspect if column.scale
+ spec[:null] = 'false' unless column.null
spec[:default] = default_string(column.default) if column.has_default?
(spec.keys - [:name, :type]).each{ |k| spec[k].insert(0, "#{k.inspect} => ")}
spec

0 comments on commit f527f90

Please sign in to comment.