warehouse_items 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/warehouse.rb +0 -1
- data/lib/warehouse/item/barcode.rb +25 -9
- data/lib/warehouse/item/code.rb +27 -7
- data/lib/warehouse/version.rb +1 -1
- metadata +1 -2
- data/lib/warehouse/item/base.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b89d5f0f304a6888274847e417e27c74fae9444
|
4
|
+
data.tar.gz: cbe617fabef2b617691855d6d629bd00e8d27bc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31033a056576526da3ba4b74399b46189af5d745cb522b57e1b8383b20e9ad247e0aef131b0ac47e94b2842650200d437a949a17c780674e6d441868f42ad64f
|
7
|
+
data.tar.gz: 9a23c3aed31ac2b1d0ea25f64ffc0ad85932fee7bba92068d808883a2959d1c6e2b58c812be2d44a73c726935cfecacb5482cce7a94cf55ac69d4e7e2abf3664
|
data/Gemfile.lock
CHANGED
data/lib/warehouse.rb
CHANGED
@@ -2,7 +2,6 @@ require "warehouse/version"
|
|
2
2
|
require 'active_support/core_ext/object'
|
3
3
|
require 'active_support/core_ext/class'
|
4
4
|
require 'active_support'
|
5
|
-
require "warehouse/item/base"
|
6
5
|
require "warehouse/item/code"
|
7
6
|
require "warehouse/item/barcode"
|
8
7
|
require "warehouse/item/random"
|
@@ -1,26 +1,42 @@
|
|
1
1
|
module Warehouse
|
2
2
|
module Item
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Barcode = Struct.new(:barcode, :title, :qty) do
|
4
|
+
|
5
|
+
def barcode?
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
def code?
|
10
|
+
false
|
11
|
+
end
|
12
|
+
|
13
|
+
def type
|
14
|
+
'single'
|
7
15
|
end
|
8
16
|
|
9
|
-
def
|
10
|
-
|
17
|
+
def random?
|
18
|
+
false
|
11
19
|
end
|
12
20
|
|
13
|
-
def
|
14
|
-
|
21
|
+
def single?
|
22
|
+
true
|
15
23
|
end
|
16
24
|
|
17
25
|
def to_h
|
18
26
|
{
|
19
|
-
'barcode' =>
|
27
|
+
'barcode' => barcode,
|
20
28
|
'title' => title,
|
21
29
|
'qty' => qty
|
22
30
|
}
|
23
31
|
end
|
32
|
+
|
33
|
+
def deep_dup
|
34
|
+
self.class.new(barcode, title, qty)
|
35
|
+
end
|
36
|
+
|
37
|
+
# 給 form 用的
|
38
|
+
def persisted?; false end
|
39
|
+
def product; end
|
24
40
|
end
|
25
41
|
end
|
26
42
|
end
|
data/lib/warehouse/item/code.rb
CHANGED
@@ -1,22 +1,42 @@
|
|
1
1
|
module Warehouse
|
2
2
|
module Item
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Code = Struct.new(:code, :title, :qty, :price) do
|
4
|
+
|
5
|
+
def barcode?
|
6
|
+
false
|
7
|
+
end
|
8
|
+
|
9
|
+
def code?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def type
|
14
|
+
'single'
|
7
15
|
end
|
8
16
|
|
9
|
-
def
|
10
|
-
|
17
|
+
def random?
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
def single?
|
22
|
+
true
|
11
23
|
end
|
12
24
|
|
13
25
|
def to_h
|
14
26
|
{
|
15
|
-
'code' =>
|
27
|
+
'code' => code,
|
16
28
|
'title' => title,
|
17
29
|
'qty' => qty
|
18
30
|
}
|
19
31
|
end
|
32
|
+
|
33
|
+
def deep_dup
|
34
|
+
self.class.new(code, title, qty, price)
|
35
|
+
end
|
36
|
+
|
37
|
+
# 給 form 用的
|
38
|
+
def persisted?; false end
|
39
|
+
def product; end
|
20
40
|
end
|
21
41
|
end
|
22
42
|
end
|
data/lib/warehouse/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warehouse_items
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eddie Li
|
@@ -98,7 +98,6 @@ files:
|
|
98
98
|
- bin/setup
|
99
99
|
- lib/warehouse.rb
|
100
100
|
- lib/warehouse/item/barcode.rb
|
101
|
-
- lib/warehouse/item/base.rb
|
102
101
|
- lib/warehouse/item/code.rb
|
103
102
|
- lib/warehouse/item/random.rb
|
104
103
|
- lib/warehouse/list.rb
|
data/lib/warehouse/item/base.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
module Warehouse
|
2
|
-
module Item
|
3
|
-
Base = Struct.new(:code_or_barcode, :title, :qty, :price) do
|
4
|
-
attr_accessor :code_type
|
5
|
-
attr_accessor :items
|
6
|
-
|
7
|
-
def barcode?
|
8
|
-
code_type == :barcode
|
9
|
-
end
|
10
|
-
|
11
|
-
def code?
|
12
|
-
code_type == :code
|
13
|
-
end
|
14
|
-
|
15
|
-
def type
|
16
|
-
'single'
|
17
|
-
end
|
18
|
-
|
19
|
-
def random?
|
20
|
-
false
|
21
|
-
end
|
22
|
-
|
23
|
-
def single?
|
24
|
-
true
|
25
|
-
end
|
26
|
-
|
27
|
-
def deep_dup
|
28
|
-
self.class.new(code_or_barcode, title, qty, price)
|
29
|
-
end
|
30
|
-
|
31
|
-
# 給 form 用的
|
32
|
-
def persisted?; false end
|
33
|
-
def product; end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|