super_tools 0.0.5 → 0.0.6

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: 559bed5f3eb37ab3de3a0172118ba10e21c55994
4
- data.tar.gz: 7c83b04099f2b71186fa4cbfa6d2b4c2c81a0f87
3
+ metadata.gz: 9e21771994fe2ec1175d5bcdc7c5b62b43d40efd
4
+ data.tar.gz: 536caa01f8d3315ff7479269cb286a92d279782c
5
5
  SHA512:
6
- metadata.gz: 93c563f466ea0c89373ac9cdc02401a64298cb82d846f68611fadfda4b7a0cc80182cf834c2efae4d1594208a3de065667b73f2e768b5fb119b7711a711526ea
7
- data.tar.gz: d4dcdcfe133b1a8b244768ba191559f6cdc3b9b10875953f1aaf7dbb2c5d480cb5bc34d2e7416d99a0fca3ab41d489c0366f819e6bcead69f73f0e7d42b68e8a
6
+ metadata.gz: 9542660e093624d703c1e6b43c5d02870a0f3d3e6e3c75def353c9603511d3c6604db9061708475d96d867cd762847839f9c18e819a519b954c033229ad7e9cd
7
+ data.tar.gz: 163cc2df600e87ba9d26724bee3e7d3c4d00e9a20640275c6c36146ae42b10fc52e33fd392abb7840e7cda48294d266eb4856a51d91e076ee9578213636d5c52
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- super_tools (0.0.4)
4
+ super_tools (0.0.5)
5
5
  dry-logic (~> 0.4.2)
6
6
  dry-types (~> 0.13.2)
7
7
  fast_excel
@@ -16,7 +16,7 @@ PATH
16
16
  searchkick
17
17
  spreadsheet
18
18
  virtus (~> 1.0.5)
19
- warehouse_items (~> 0.2.0)
19
+ warehouse_items (~> 0.3.0)
20
20
 
21
21
  GEM
22
22
  remote: https://rubygems.org/
@@ -207,7 +207,7 @@ GEM
207
207
  coercible (~> 1.0)
208
208
  descendants_tracker (~> 0.0, >= 0.0.3)
209
209
  equalizer (~> 0.0, >= 0.0.9)
210
- warehouse_items (0.2.0)
210
+ warehouse_items (0.3.0)
211
211
  activesupport
212
212
  websocket-driver (0.6.5)
213
213
  websocket-extensions (>= 0.1.0)
data/README.md CHANGED
@@ -1,39 +1,134 @@
1
- # SuperTools
1
+ # SuperForm::Reform
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/super_tools`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ```ruby
4
+ class MerchantForm::Edit < SuperForm::Reform
5
+ model :merchant
6
+
7
+ property :title, default: ''
8
+ property :contact, default: ''
9
+ end
10
+
11
+ ```
4
12
 
5
- TODO: Delete this and the text above, and describe your gem
13
+ # SuperLogger::Formatter
6
14
 
7
- ## Installation
15
+ 就是之前的 `LoggerFormatter`
8
16
 
9
- Add this line to your application's Gemfile:
17
+ # SuperProcess::Core
10
18
 
11
19
  ```ruby
12
- gem 'super_tools'
20
+ class BillingCalculate < SuperProcess::Core
21
+ init :billing do
22
+ attribute :total_orders_amount, Integer
23
+ end
24
+
25
+ callable do
26
+ "RESULT_OBJECT"
27
+ end
28
+
29
+ def valid_amount
30
+ if total_orders_amount > 1000
31
+ errors.add(:total_orders_amount, "金額必須小於 1000 元")
32
+ end
33
+ end
34
+ end
35
+
36
+ @service = BillingCalculate.new(@billing)
37
+ @service.call(total_orders_amount: "100")
38
+ #=> true
39
+ @service.total_orders_amount
40
+ #=> 100
41
+ @service.result
42
+ #=> "RESULT_OBJECT"
43
+ @service.error_messages
44
+ #=> ""
13
45
  ```
14
46
 
15
- And then execute:
47
+ # SuperZipcode::Taiwan
16
48
 
17
- $ bundle
49
+ ```ruby
50
+ SuperZipcode::Taiwan.find_zip_code("高雄市鳳山區鳳甲一街129號")
51
+ #=> 830
52
+ ```
18
53
 
19
- Or install it yourself as:
54
+ # SuperTable
20
55
 
21
- $ gem install super_tools
56
+ 如需要 Rails URL helper 請於 initializers/suepr_table.rb 自行混入
22
57
 
23
- ## Usage
58
+ ```ruby
59
+ SuperTable::Builder.send(:include, ::Rails.application.routes.url_helpers)
60
+ SuperTable::Record.send(:include, ::Rails.application.routes.url_helpers)
61
+ SuperTable::Tableable.send(:include, ::Rails.application.routes.url_helpers)
62
+ ```
24
63
 
25
- TODO: Write usage instructions here
64
+ # SuperSpreadsheet::Loader
26
65
 
27
- ## Development
66
+ ```ruby
67
+ @spreadsheet = SuperSpreadsheet::Loader.new("/tmp/xxx.csv").tap { |s| s.call }
68
+ @spreadsheet = SuperSpreadsheet::Loader.new("/tmp/xxx.xls").tap { |s| s.call }
69
+ @spreadsheet = SuperSpreadsheet::Loader.new("/tmp/xxx.xlsx").tap { |s| s.call }
28
70
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
71
+ @spreadsheet.result
72
+ #=> [ [ '欄位1', '欄位2', '欄位3' ], [ '資料1', '資料2', '資料3'] ]
73
+ ```
30
74
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
+ # SuperSearch::Scroll
32
76
 
33
- ## Contributing
77
+ ```ruby
78
+ ::SuperSearch::Scroll.new(Member, options: { where: { age: 20 } })
79
+ ```
80
+
81
+ # SuperInteraction
82
+
83
+ ### app/controllers/application_controller.rb
84
+
85
+ ```ruby
86
+ class ApplicationController < ActionController::Base
87
+ include SuperInteraction::ControllerHelper
88
+ end
89
+ ```
34
90
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/super_tools.
91
+ ### app/controllers/members_controller.rb
36
92
 
37
- ## License
93
+ ```ruby
94
+ class MembersController < ApplicationController
95
+ # GET /
96
+ def index
97
+ js.alert("Helloworld").reload.run
98
+ end
99
+
100
+ # GET /
101
+ def new
102
+ @member = Member.new
103
+ # View: app/views/members/edit.html.haml
104
+ # Layout: app/views/layouts/modal.html.haml
105
+ js.modal(partial: :edit).run
106
+ end
107
+ end
108
+ ```
38
109
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
110
+ ### app/views/layouts/modal.html.haml
111
+
112
+ ```haml
113
+ .modal
114
+ = yield :wrapper
115
+ .modal-dialog{ class: "modal-#{bs_modal_size}" }
116
+ .modal-content
117
+ .modal-header
118
+ %button.close{"aria-label" => "Close", "data-dismiss" => "modal", :type => "button"}
119
+ = fa_icon('times')
120
+ = yield :header
121
+ - if title.present?
122
+ %h4.modal-title= title
123
+ = yield
124
+ = yield :before_body
125
+ - body_html = capture { yield :body }
126
+ - if body_html.present?
127
+ .modal-body= body_html
128
+ = yield :after_body
129
+
130
+ - footer_html = capture { yield :footer }
131
+ - if footer_html.present?
132
+ .modal-footer= footer_html
133
+
134
+ ```
@@ -3,6 +3,14 @@ module SuperFormatter
3
3
  module Ecan
4
4
  class Row < ::SuperFormatter::Row
5
5
 
6
+ def global_order_id
7
+ order_id = (find(:global_order_id) || "")
8
+ if order_id[0] == 'C'
9
+ order_id[1, order_id.length - 1]
10
+ else
11
+ order_id
12
+ end
13
+ end
6
14
  end
7
15
  end
8
16
  end
@@ -1,3 +1,3 @@
1
1
  module SuperTools
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - eddie