chicagowarehouse 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ require 'rake'
14
14
  require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
16
  gem.name = "chicagowarehouse"
17
- gem.version = "0.3.2"
17
+ gem.version = "0.3.3"
18
18
  gem.summary = "Ruby Data Warehousing"
19
19
  gem.description = "Simple Data Warehouse toolkit for ruby"
20
20
  gem.author = "Roland Swingler"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{chicagowarehouse}
8
- s.version = "0.3.2"
8
+ s.version = "0.3.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Roland Swingler}]
12
- s.date = %q{2012-10-29}
12
+ s.date = %q{2012-10-30}
13
13
  s.description = %q{Simple Data Warehouse toolkit for ruby}
14
14
  s.email = %q{roland.swingler@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -66,7 +66,7 @@ module Chicago
66
66
 
67
67
  unless to_join.empty?
68
68
  @dataset = to_join.inject(@dataset) do |dataset, t|
69
- dataset.join(t.table_name.as(t.name), :id => t.key_name.qualify(@base_table.name))
69
+ dataset.join(t.table_name.as(t.name), :id => t.database_name.qualify(@base_table.name))
70
70
  end
71
71
  end
72
72
  end
@@ -91,7 +91,7 @@ module Chicago
91
91
  def indexes
92
92
  indexes = @table.columns.select(&:indexed?).inject({}) do |hsh, d|
93
93
  hsh.merge("#{d.name}_idx".to_sym => {
94
- :columns => d.key_name,
94
+ :columns => d.database_name,
95
95
  :unique => false})
96
96
  end
97
97
  indexes.merge!(natural_key_index) if @table.natural_key
@@ -109,7 +109,7 @@ module Chicago
109
109
 
110
110
  def natural_key_index_columns
111
111
  @table.natural_key.map do |name|
112
- @table[name].key_name rescue raise MissingDefinitionError.new("Column #{name} is not defined in #{@table.name}")
112
+ @table[name].database_name rescue raise MissingDefinitionError.new("Column #{name} is not defined in #{@table.name}")
113
113
  end
114
114
  end
115
115
  end
@@ -97,7 +97,7 @@ module Chicago
97
97
 
98
98
  attr_reader :countable_label
99
99
 
100
- alias :key_name :name
100
+ alias :database_name :name
101
101
 
102
102
  # Returns true if this column can be counted.
103
103
  def countable?
@@ -9,8 +9,6 @@ module Chicago
9
9
  extend Forwardable
10
10
 
11
11
  def_delegators :@dimension, :columns, :column_definitions, :identifiers, :main_identifier, :identifiable?, :original_key, :natural_key, :table_name, :[], :key_table_name
12
-
13
- attr_reader :key_name
14
12
 
15
13
  def initialize(name, dimension, opts={})
16
14
  super name, :integer, opts.merge(:min => 0)
@@ -19,9 +17,14 @@ module Chicago
19
17
  @key_name = opts[:key_name] || "#{@name}_dimension_id".to_sym
20
18
  end
21
19
 
20
+ # Returns the key name of this dimension.
21
+ def database_name
22
+ @key_name
23
+ end
24
+
22
25
  def to_hash
23
26
  hsh = super
24
- hsh[:name] = @key_name
27
+ hsh[:name] = database_name
25
28
  hsh
26
29
  end
27
30
 
@@ -30,7 +33,7 @@ module Chicago
30
33
  end
31
34
 
32
35
  def qualify_by(table)
33
- @key_name.qualify(table)
36
+ database_name.qualify(table)
34
37
  end
35
38
 
36
39
  # Returns the first null record id for this dimension, or 0 if
@@ -59,8 +59,9 @@ describe Chicago::Schema::DimensionReference do
59
59
  described_class.new(:foo, @dimension).column_type.should == :integer
60
60
  end
61
61
 
62
- it "should have a key name" do
63
- described_class.new(:foo, @dimension).key_name.should == :foo_dimension_id
62
+ it "has the key column as the database name" do
63
+ described_class.new(:foo, @dimension).database_name.
64
+ should == :foo_dimension_id
64
65
  end
65
66
 
66
67
  it "qualfies a column based on the column name" do
@@ -70,7 +71,8 @@ describe Chicago::Schema::DimensionReference do
70
71
  end
71
72
 
72
73
  it "can be qualified, and qualifies the key name" do
73
- described_class.new(:foo, @dimension).qualify_by(:facts_bar).should == :foo_dimension_id.qualify(:facts_bar)
74
+ described_class.new(:foo, @dimension).qualify_by(:facts_bar).
75
+ should == :foo_dimension_id.qualify(:facts_bar)
74
76
  end
75
77
 
76
78
  it "should be considered a kind of dimension" do
@@ -78,7 +80,8 @@ describe Chicago::Schema::DimensionReference do
78
80
  end
79
81
 
80
82
  it "can override the key selected as the reference" do
81
- described_class.new(:foo, @dimension, :key_name => :baz_dimension_id).key_name.should ==:baz_dimension_id
83
+ described_class.new(:foo, @dimension, :key_name => :baz_dimension_id).
84
+ database_name.should ==:baz_dimension_id
82
85
  end
83
86
 
84
87
  it "uses the first null record id as the default value" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chicagowarehouse
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roland Swingler
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-10-29 00:00:00 Z
18
+ date: 2012-10-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  requirement: &id001 !ruby/object:Gem::Requirement