hobo_fields 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dd86ea58f333b2b604f564c34fbd1fa881de752a
4
+ data.tar.gz: 362708497d9bb86e9180d2aa54fcf54cfd1b1bab
5
+ SHA512:
6
+ metadata.gz: 4902e3628e1c82294c3c5039cc66b686d5f9e993509dbb624808a311e7a9e80e58a183509ef5e74b883bce26cde777730a7c9b235f9c3061937109996d1b0cf4
7
+ data.tar.gz: befa22f838ac4ece879a18b2693d5e56fde46d18b8e70b29fbd2b281692bedd0ffc00fc6c85648c03d34678cb7d0a27990b4c9612f41a1e3eeaebba1dbde6bd0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
@@ -9,15 +9,19 @@ module HoboFields
9
9
  self.fields = Array.wrap(fields).*.to_s
10
10
  self.name = options.delete(:name) || model.connection.index_name(self.table, :column => self.fields)
11
11
  self.unique = options.delete(:unique) || false
12
+ if options[:where]
13
+ self.where = "#{options.delete(:where)}"
14
+ self.where = "(#{self.where})" unless self.where.start_with?('(')
15
+ end
12
16
  end
13
17
 
14
- attr_accessor :table, :fields, :name, :unique
18
+ attr_accessor :table, :fields, :name, :unique, :where
15
19
 
16
20
  # extract IndexSpecs from an existing table
17
21
  def self.for_model(model, old_table_name=nil)
18
22
  t = old_table_name || model.table_name
19
23
  model.connection.indexes(t).map do |i|
20
- self.new(model, i.columns, :name => i.name, :unique => i.unique, :table_name => old_table_name) unless model.ignore_indexes.include?(i.name)
24
+ self.new(model, i.columns, :name => i.name, :unique => i.unique, :where => i.where, :table_name => old_table_name) unless model.ignore_indexes.include?(i.name)
21
25
  end.compact
22
26
  end
23
27
 
@@ -28,6 +32,7 @@ module HoboFields
28
32
  def to_add_statement(new_table_name)
29
33
  r = "add_index :#{new_table_name}, #{fields.*.to_sym.inspect}"
30
34
  r += ", :unique => true" if unique
35
+ r += ", :where => '#{self.where}'" if self.where.present?
31
36
  if default_name?
32
37
  check_name = @model.connection.index_name(self.table, :column => self.fields)
33
38
  else
@@ -43,7 +48,7 @@ module HoboFields
43
48
  end
44
49
 
45
50
  def hash
46
- [table, fields, name, unique].hash
51
+ [table, fields, name, unique, where].hash
47
52
  end
48
53
 
49
54
  def ==(v)
@@ -64,7 +64,6 @@ module HoboFields
64
64
  attrs << options unless options.empty?
65
65
  public
66
66
  attr_accessor_without_rich_types(*attrs)
67
- private
68
67
 
69
68
  if type
70
69
  type = HoboFields.to_class(type)
metadata CHANGED
@@ -1,78 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
5
- prerelease:
4
+ version: 2.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tom Locke
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-26 00:00:00.000000000 Z
11
+ date: 2014-07-17 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- type: :runtime
16
14
  name: hobo_support
17
- prerelease: false
18
15
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
16
  requirements:
21
17
  - - '='
22
18
  - !ruby/object:Gem::Version
23
- version: 2.1.0
19
+ version: 2.1.1
20
+ type: :runtime
21
+ prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
29
- version: 2.1.0
26
+ version: 2.1.1
30
27
  - !ruby/object:Gem::Dependency
31
- type: :development
32
28
  name: rubydoctest
33
- prerelease: false
34
29
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
30
  requirements:
37
- - - ! '>='
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: '0'
34
+ type: :development
35
+ prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
- type: :development
48
42
  name: RedCloth
49
- prerelease: false
50
43
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
44
  requirements:
53
- - - ! '>='
45
+ - - ">="
54
46
  - !ruby/object:Gem::Version
55
47
  version: '0'
48
+ type: :development
49
+ prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- type: :development
64
56
  name: kramdown
65
- prerelease: false
66
57
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
58
  requirements:
69
- - - ! '>='
59
+ - - ">="
70
60
  - !ruby/object:Gem::Version
71
61
  version: '0'
62
+ type: :development
63
+ prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: Rich field types and migration generator for Rails
@@ -128,28 +119,27 @@ files:
128
119
  - test_responses.txt
129
120
  homepage: http://hobocentral.net
130
121
  licenses: []
122
+ metadata: {}
131
123
  post_install_message:
132
124
  rdoc_options:
133
- - --charset=UTF-8
125
+ - "--charset=UTF-8"
134
126
  require_paths:
135
127
  - lib
136
128
  required_ruby_version: !ruby/object:Gem::Requirement
137
- none: false
138
129
  requirements:
139
- - - ! '>='
130
+ - - ">="
140
131
  - !ruby/object:Gem::Version
141
132
  version: '0'
142
133
  required_rubygems_version: !ruby/object:Gem::Requirement
143
- none: false
144
134
  requirements:
145
- - - ! '>='
135
+ - - ">="
146
136
  - !ruby/object:Gem::Version
147
137
  version: 1.3.6
148
138
  requirements: []
149
139
  rubyforge_project: hobo
150
- rubygems_version: 1.8.25
140
+ rubygems_version: 2.2.2
151
141
  signing_key:
152
- specification_version: 3
142
+ specification_version: 4
153
143
  summary: Rich field types and migration generator for Rails
154
144
  test_files: []
155
145
  has_rdoc: