data_miner 0.4.37 → 0.4.38

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.37
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.37"
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
@@ -18,6 +18,7 @@ require 'andand'
18
18
  require 'log4r'
19
19
  require 'fileutils'
20
20
  require 'tmpdir'
21
+ require 'zlib'
21
22
 
22
23
  require 'data_miner/attribute'
23
24
  require 'data_miner/configuration'
@@ -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] || connection.index_name(table_name, options.merge(:column => columns))
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
@@ -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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 37
9
- version: 0.4.37
8
+ - 38
9
+ version: 0.4.38
10
10
  platform: ruby
11
11
  authors:
12
12
  - Seamus Abshere