armg 0.8.0 → 0.8.1

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
  SHA256:
3
- metadata.gz: 3e4ca3fe09582ef36a6cfadc4e3f56010ad26a6abbf09be3702e759c39d4e607
4
- data.tar.gz: 11d7a00ae8b7965ffe45de2f1f0b0acb23d0f21387d279c7277b26a665ef6061
3
+ metadata.gz: 87b091745ad8e4956f0fe1d82c5550d6c700feeb34541fef66e96309f3bcf09c
4
+ data.tar.gz: 0a045f637a8914a492cf93579f85399a6510183e23425ea152e864a81d9f8d8d
5
5
  SHA512:
6
- metadata.gz: 75278e9e72486f578d831c7559811259408411c7551eac3adb99823a6625b7dfa1e135646909756a00270a695300ce991efaac92c5a239adefc8ebc11fc3b398
7
- data.tar.gz: f7011b294d0dcbdfd4d801f8ff0c2c782b1dc7f1fb423e99c341e32fafa09f9f1b03c86113787926a34e4af7c2e86068904a3816ad6ff69bd2d6b90a2f504302
6
+ metadata.gz: e448dc89ea4e86c696a06a7e16ea09634a729347592ddfe0372ee9dd18dbda6f243f5313f05b2f84872171c84585c69def8207cf4a8aa6f0d2b0ab9006a5a2ca
7
+ data.tar.gz: 9f426744830c050aa10152aa062232dc1bf9758b819c768b600f582c07ae3099acbb4413d43f2180c1b1a76593636192c6d06817770540922aef14abb895b845
@@ -16,3 +16,9 @@ Style/AccessModifierDeclarations:
16
16
  Enabled: false
17
17
  Style/Documentation:
18
18
  Enabled: false
19
+ Style/HashEachMethods:
20
+ Enabled: true
21
+ Style/HashTransformKeys:
22
+ Enabled: true
23
+ Style/HashTransformValues:
24
+ Enabled: true
data/README.md CHANGED
@@ -113,6 +113,42 @@ bundle exec appraisal ar51 rake
113
113
  # ARMG_TEST_MYSQL_PORT=10057 ARMG_TEST_MYSQL_ENGINE=InnoDB bundle exec appraisal ar51 rake
114
114
  ```
115
115
 
116
+ ## Using with [Ridgepole](https://github.com/winebarrel/ridgepole)
117
+
118
+ You need to extend the TableDefinition class.
119
+
120
+ ```ruby
121
+ # ridgepole-geo.rb
122
+ module Ridgepole
123
+ class DSLParser
124
+ class TableDefinition
125
+ def geometry(*args)
126
+ options = args.extract_options!
127
+ column_names = args
128
+ column_names.each { |name| column(name, :geometry, options) }
129
+ end
130
+ end
131
+ end
132
+ end
133
+ ```
134
+
135
+ ```sh
136
+ $ ridgepole -c 'mysql2://root@127.0.0.1:10057/armg_test' -r armg -e > Schemafile
137
+
138
+ $ cat Schemafile
139
+ # Export Schema
140
+ create_table "geoms", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
141
+ t.geometry "location", null: false
142
+ t.string "name"
143
+ t.index ["location"], name: "idx_location", length: 32, type: :spatial
144
+ t.index ["name"], name: "idx_name", length: 10
145
+ end
146
+
147
+ $ ridgepole -c 'mysql2://root@127.0.0.1:10057/armg_test' -r armg,ridgepole-geo -a
148
+ Apply `Schemafile`
149
+ No change
150
+ ```
151
+
116
152
  ## Related links
117
153
 
118
154
  * [rgeo/rgeo: Geospatial data library for Ruby](https://github.com/rgeo/rgeo)
@@ -6,9 +6,16 @@ module Armg
6
6
  :geometry
7
7
  end
8
8
 
9
+ def binary?
10
+ true
11
+ end
12
+
9
13
  def deserialize(value)
10
- if value.is_a?(::String)
14
+ case value
15
+ when ::String
11
16
  Armg.deserializer.deserialize(value)
17
+ when ActiveModel::Type::Binary::Data
18
+ Armg.deserializer.deserialize(value.to_s)
12
19
  else
13
20
  value
14
21
  end
@@ -18,7 +25,8 @@ module Armg
18
25
  if value.nil?
19
26
  nil
20
27
  else
21
- Armg.serializer.serialize(value)
28
+ value = Armg.serializer.serialize(value)
29
+ ActiveModel::Type::Binary::Data.new(value)
22
30
  end
23
31
  end
24
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Armg
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: armg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-04 00:00:00.000000000 Z
11
+ date: 2020-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord