coaster 1.3.34 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b74632abeea191ac11160939d23c3bd946cb48880bcf0d804513d4a1571cacd
4
- data.tar.gz: cac164004edff9cd0454714e60cf4f896a2d96f61fa51ac16e1b3f1cd1ac0cfd
3
+ metadata.gz: 184ceccb2f814adeae83aadb4f7740db5d2b4f0a7d7b1389bef09144c9c634e4
4
+ data.tar.gz: 98ff36f4fc6ae8f71b9d89a278e34154dbc02579e1229a17724be2f0870304e7
5
5
  SHA512:
6
- metadata.gz: 5ec894acd59493e72c0e644461ff9b6d607dff5b6b13131fe28141e7a48922a703488345ba326d6bc5b2a86729c1f1b35117fd553e5d887fb3e1698016fb8e37
7
- data.tar.gz: 6cd29ad2fd087537de3b366bd11d8da6f0aee6ac7c81f1d42f71324ebbd6c729f8989c9fdf7ee3debce018a7fef2880309116a48ec7ae560b5d726e87f1d1427
6
+ metadata.gz: eeb8e4a6c489a6765ad0705e65154151d272d4a4dfad64458da94f292a6decbc086a68703070472a92b20c0344816fcc8695d5b4205d9c1efbaf3ee25aa90f04
7
+ data.tar.gz: cdfec6c9d37031b28a40403f67420900ff0f188bddfac729d4efa521a807849aa82ff3fc8b3405c1aeeb141389b880925cdcb24f14e5d07b0c027474739b4866
@@ -1,3 +1,5 @@
1
+ require 'optparse'
2
+
1
3
  module Coaster
2
4
  class CmdOptions
3
5
  class << self
@@ -9,36 +11,6 @@ module Coaster
9
11
  end
10
12
  end
11
13
 
12
- def options_s_to_h(options)
13
- opts = {}
14
- options = " #{options}"
15
- options_indexes = options.enum_for(:scan, / -\w| --\w+| -- /).map { Regexp.last_match.begin(0) }
16
- options_indexes << 0
17
- options_indexes.each_cons(2) do |a, b|
18
- option = options[a+1..b-1]
19
- h = option_s_to_h(option)
20
- options_h_merger(h, base: opts)
21
- end
22
- opts
23
- end
24
-
25
- def option_s_to_h(option)
26
- if option.start_with?(/--\w/)
27
- opt = option.split('=', 2)
28
- opt << '' if opt.length == 1
29
- elsif option.start_with?(/-\w/)
30
- opt = option.split(' ', 2)
31
- opt << '' if opt.length == 1
32
- elsif option.start_with?('-- ')
33
- opt = ['--', option[3..-1].split(' ')]
34
- else
35
- return {}
36
- end
37
- opt[1] = opt[1].split(',') if opt[1].include?(',')
38
- opt[1] = opt[1].map{|s| s.include?('=') ? Hash[s.split('=', 2)] : s}.to_h if opt[1].is_a?(Array)
39
- [opt].to_h
40
- end
41
-
42
14
  def option_v_to_s(option_v)
43
15
  case option_v
44
16
  when Hash then option_v.map{|vk,vv| Set[vk, vv]}.to_set
data/lib/coaster/git.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'open3'
2
+ require 'active_support'
3
+ require 'active_support/core_ext'
2
4
 
3
5
  module Coaster
4
6
  module Git
@@ -85,6 +85,15 @@ module Coaster
85
85
  end
86
86
  },
87
87
  default: default
88
+ elsif type == :unix_epoch
89
+ _define_serialized_property(serialize_column, key,
90
+ getter: Proc.new { |val| val.nil? ? nil : Time.zone.at(val) },
91
+ setter: Proc.new { |val|
92
+ raise TypeError, "serialized_property: only time can be accepted: #{val.class}" unless val.is_a?(Time)
93
+ val.to_i
94
+ },
95
+ default: default
96
+ )
88
97
  elsif type == Integer
89
98
  _define_serialized_property serialize_column, key,
90
99
  setter: proc { |val|
@@ -95,6 +104,8 @@ module Coaster
95
104
  default: default
96
105
  elsif type == Array
97
106
  _define_serialized_property(serialize_column, key, default: default || [])
107
+ elsif type.respond_to?(:serialized_property_settings) && (settings = type.serialized_property_settings)
108
+ _define_serialized_property(serialize_column, key, getter: settings[:getter], setter: settings[:setter], setter_callback: settings[:setter_callback], default: default)
98
109
  elsif type && type < ActiveRecord::Base
99
110
  _define_serialized_property serialize_column, "#{key}_id", default: default
100
111
 
@@ -1,3 +1,3 @@
1
1
  module Coaster
2
- VERSION = '1.3.34'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.34
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - buzz jung
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-09 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj