convergence 0.1.3 → 0.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 137446e613d09e9f82e5126fef9b15f42f53b258
4
- data.tar.gz: 80f689389a919a431063b0ca9a8ff023701f64dd
3
+ metadata.gz: e466f3ae17d7a2056c5a4664712d133a29c1fd38
4
+ data.tar.gz: 5d3d4c80692c2c316bd124e8492fd86c8a140cac
5
5
  SHA512:
6
- metadata.gz: 45ec8cd62c1824db046585a7e069a62d2ad7b408ab1a4d74089429d7bc3f18a2768764af4c75d50a66bda662e735d0e12320f8ac2b6168d5df1c253822fa815a
7
- data.tar.gz: a329fe4c6cb6e15455b979083c3374cb731b032a26dd39c6aa675942f782e51a3a150dc22ae8fe2af3525d4e903fd49f65e1de839b3d30847bb29653d5e018fa
6
+ metadata.gz: 344e1601e39e9608dc44c35c22221632987d3d5a5847c3fb1235c6547847a71df2f3fc2781541a136cd22fc4f34917d4a0508795c4469b7c37ee1540cd464adb
7
+ data.tar.gz: d8d243ccabff02109c4a26b448c90ccc52b8c06de356f47a9aad2c553c0b9025f14b86393990c7cf05bddeda990d2dab6d7d6b360fa75b4df8351465dfaba247
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- convergence (0.1.3)
4
+ convergence (0.1.4)
5
5
  diff-lcs
6
6
  diffy
7
7
  mysql2
@@ -88,4 +88,4 @@ DEPENDENCIES
88
88
  rubocop
89
89
 
90
90
  BUNDLED WITH
91
- 1.10.5
91
+ 1.10.6
@@ -27,6 +27,11 @@ class Convergence::Column
27
27
  timestamp
28
28
  year
29
29
  )
30
+ FLOATING_POINT_COLUMN_TYPE = %i(
31
+ float
32
+ double
33
+ decimal
34
+ )
30
35
 
31
36
  def initialize(type, column_name, options = {})
32
37
  @type = type
@@ -3,6 +3,9 @@ class Convergence::Table
3
3
 
4
4
  Convergence::Column::COLUMN_TYPE.each do |column_type|
5
5
  define_method "#{column_type}" do |column_name, options = {}|
6
+ if Convergence::Column::FLOATING_POINT_COLUMN_TYPE.include?(column_type) && !options[:default].nil?
7
+ options[:default] = options[:default].to_f
8
+ end
6
9
  @columns[column_name.to_s] = Convergence::Column.new(column_type, column_name.to_s, options)
7
10
  end
8
11
  end
@@ -1,3 +1,3 @@
1
1
  module Convergence
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -20,6 +20,11 @@ describe Convergence::Table do
20
20
  table.int(dummy_column, limit: 100)
21
21
  expect(table.columns[dummy_column].options[:limit]).to eq(100)
22
22
  end
23
+
24
+ it 'should convert the default value to float for floating-point columns' do
25
+ table.decimal(dummy_column, default: 1)
26
+ expect(table.columns[dummy_column].options[:default]).to eq(1.0)
27
+ end
23
28
  end
24
29
 
25
30
  describe '#index' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convergence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinsuke Nishio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2015-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2