slim-attributes 0.4 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/slim_attributes.rb +0 -48
  2. metadata +1 -1
@@ -43,51 +43,3 @@ class Mysql::Result
43
43
  end
44
44
 
45
45
  require 'slim_attrib_ext'
46
-
47
- class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
48
- def select(sql, name = nil)
49
- fields, rows = select_raw(sql, name)
50
- result = []
51
- for row in rows
52
- row_hash = {}
53
- fields.each_with_index do |f, i|
54
- row_hash[f] = row[i]
55
- end
56
- result << row_hash
57
- end
58
- result
59
- end
60
-
61
- def select_raw(sql, name = nil)
62
- res = execute(sql, name)
63
- results = result_as_array(res)
64
- fields = []
65
- rows = []
66
- if res.ntuples > 0
67
- fields = res.fields
68
- results.each do |row|
69
- row.each_index do |cell_index|
70
- # If this is a money type column and there are any currency symbols,
71
- # then strip them off. Indeed it would be prettier to do this in
72
- # PostgreSQLColumn.string_to_decimal but would break form input
73
- # fields that call value_before_type_cast.
74
- if res.ftype(cell_index) == MONEY_COLUMN_TYPE_OID
75
- # Because money output is formatted according to the locale, there are two
76
- # cases to consider (note the decimal separators):
77
- # (1) $12,345,678.12
78
- # (2) $12.345.678,12
79
- case column = row[cell_index]
80
- when /^-?\D+[\d,]+\.\d{2}$/ # (1)
81
- row[cell_index] = column.gsub(/[^-\d\.]/, '')
82
- when /^-?\D+[\d\.]+,\d{2}$/ # (2)
83
- row[cell_index] = column.gsub(/[^-\d,]/, '').sub(/,/, '.')
84
- end
85
- end
86
- end
87
- rows << row
88
- end
89
- end
90
- res.clear
91
- return fields, rows
92
- end
93
- end
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: slim-attributes
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.4"
6
+ version: 0.4.1
7
7
  date: 2008-05-18 00:00:00 +03:00
8
8
  summary: Slim attributes boosts speed in Rails/Mysql ActiveRecord Models by avoiding instantiating Hashes for each result row, and lazily instantiating attributes as needed
9
9
  require_paths: