data_miner 0.4.37 → 0.4.38
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.
- data/VERSION +1 -1
- data/data_miner.gemspec +1 -1
- data/lib/data_miner.rb +1 -0
- data/lib/data_miner/schema.rb +6 -1
- data/test/data_miner_test.rb +9 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.38
|
data/data_miner.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{data_miner}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.38"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Seamus Abshere", "Andy Rossmeissl"]
|
data/lib/data_miner.rb
CHANGED
data/lib/data_miner/schema.rb
CHANGED
@@ -59,10 +59,15 @@ module DataMiner
|
|
59
59
|
def column(*args)
|
60
60
|
ideal_table.column(*args)
|
61
61
|
end
|
62
|
+
|
63
|
+
MAX_INDEX_NAME_LENGTH = 50
|
62
64
|
def index(columns, options = {})
|
63
65
|
options.symbolize_keys!
|
64
66
|
columns = Array.wrap columns
|
65
|
-
name = options[:name]
|
67
|
+
unless name = options[:name]
|
68
|
+
default_name = connection.index_name(table_name, options.merge(:column => columns))
|
69
|
+
name = default_name.length < MAX_INDEX_NAME_LENGTH ? default_name : default_name[0..MAX_INDEX_NAME_LENGTH-11] + Zlib.crc32(default_name).to_s
|
70
|
+
end
|
66
71
|
index_unique = options.has_key?(:unique) ? options[:unique] : true
|
67
72
|
ideal_indexes.push ActiveRecord::ConnectionAdapters::IndexDefinition.new(table_name, name, index_unique, columns)
|
68
73
|
end
|
data/test/data_miner_test.rb
CHANGED
@@ -980,6 +980,14 @@ class Aircraft < ActiveRecord::Base
|
|
980
980
|
row['Manufacturer'] =~ /BOEING/i
|
981
981
|
end
|
982
982
|
|
983
|
+
def is_attributed_to_cessna?(row)
|
984
|
+
row['Manufacturer'] =~ /CESSNA/i
|
985
|
+
end
|
986
|
+
|
987
|
+
def is_attributed_to_fokker?(row)
|
988
|
+
row['Manufacturer'] =~ /FOKKER/i
|
989
|
+
end
|
990
|
+
|
983
991
|
def is_not_attributed_to_aerospatiale?(row)
|
984
992
|
not row['Manufacturer'] =~ /AEROSPATIALE/i
|
985
993
|
end
|
@@ -1137,6 +1145,7 @@ class CensusDivisionTrois < ActiveRecord::Base
|
|
1137
1145
|
string 'census_region_name'
|
1138
1146
|
integer 'census_region_number'
|
1139
1147
|
index 'census_region_name', :name => 'homefry'
|
1148
|
+
index ['number_code', 'name', 'census_region_name', 'census_region_number', 'updated_at', 'created_at']
|
1140
1149
|
end
|
1141
1150
|
end
|
1142
1151
|
end
|