ass_ole-snippets-shared 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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7e2c1c8bcd7219cfb26247a03bb16cce0ef1d4a
|
4
|
+
data.tar.gz: cc8950f788887851c9c1f51d992367db756881ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c3339f9d1829f79f6ca766df0b1ae4dc219e1883f4ef9e661ed91afc3b7b67169a9d865bb29d2154552f848700078ac8b75beff5fcf7404b2ce049f56573d00
|
7
|
+
data.tar.gz: 6555be8e6eb1c1fca1148794673d2e94b8801b3baca3db74e4330e1fde3b8c5ea0ec5dfbaf90456fe9cb5add2b2462fff8be379971ef76ed33884f29b4a9fcb5
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module AssOle
|
2
|
+
module Snippets
|
3
|
+
#
|
4
|
+
module Shared
|
5
|
+
# Snippet for worcking with 1C +ValueTable+ object
|
6
|
+
# @example
|
7
|
+
# like_ole_runtime External
|
8
|
+
# include AssOle::Snippets::Shared::ValueTable
|
9
|
+
#
|
10
|
+
# # Make new ValueTable with f1, f2, f3 columns
|
11
|
+
# value_table :f1, :f2, :f3 # => WIN32OLE
|
12
|
+
#
|
13
|
+
# # Make new ValueTable and insert into 1 row
|
14
|
+
# actual = value_table :f1, :f2, :f3 do |vt_wrapper|
|
15
|
+
# vt_wrapper.add f1: 0, f2: 1, f3: 2
|
16
|
+
# end # => WIN32OLE
|
17
|
+
#
|
18
|
+
# # Make new ValueTable and insert into 3 rows
|
19
|
+
# value_table :f1, :f2, :f3 do |vt_wrapper|
|
20
|
+
# 3.times do |r|
|
21
|
+
# vt_wrapper.add do |row|
|
22
|
+
# row.f1 = r
|
23
|
+
# row.f2 = 10 + r
|
24
|
+
# row.f3 = 20 + r
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# end # => WIN32OLE
|
28
|
+
module ValueTable
|
29
|
+
# Warapper for add rows into +ValueTable+
|
30
|
+
# @api private
|
31
|
+
class Wrapper
|
32
|
+
# @return [WIN32OLE] +ValueTable+ object
|
33
|
+
attr_reader :ole
|
34
|
+
def initialize(ole)
|
35
|
+
@ole = ole
|
36
|
+
end
|
37
|
+
|
38
|
+
# Add ValueTableRow into +ValueTable+
|
39
|
+
# @return [WIN32OLE] 1C +ValueTableRow+ object
|
40
|
+
# @param options [Hash] +ValueTableRow+ values
|
41
|
+
# @api public
|
42
|
+
# @yield [WIN32OLE] added +ValueTableRow+ object
|
43
|
+
def add(**options, &block)
|
44
|
+
r = ole.Add
|
45
|
+
options.each do |k, v|
|
46
|
+
r.send("#{k}=", v)
|
47
|
+
end
|
48
|
+
yield r if block_given?
|
49
|
+
r
|
50
|
+
end
|
51
|
+
|
52
|
+
# Pass other into {#ole}
|
53
|
+
def method_missing(method, *args)
|
54
|
+
ole.send(method, *args)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# @param columns [Array] +ValueTable+ columns
|
59
|
+
# @yield [Wrapper]
|
60
|
+
# @return [WIN32OLE] 1C +ValueTable+ object
|
61
|
+
def value_table(*columns, &block)
|
62
|
+
r = newObject('ValueTable')
|
63
|
+
columns.each do |coll|
|
64
|
+
r.Columns.Add(coll.to_s)
|
65
|
+
end
|
66
|
+
r = Wrapper.new(r)
|
67
|
+
yield r if block_given?
|
68
|
+
r.ole
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ass_ole-snippets-shared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Vlasov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ass_ole
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/ass_ole/snippets/shared/array.rb
|
143
143
|
- lib/ass_ole/snippets/shared/binary_data.rb
|
144
144
|
- lib/ass_ole/snippets/shared/mapped.rb
|
145
|
+
- lib/ass_ole/snippets/shared/value_table.rb
|
145
146
|
- lib/ass_ole/snippets/shared/version.rb
|
146
147
|
homepage: https://github.com/leoniv/ass_ole-snippets-shared
|
147
148
|
licenses: []
|
@@ -167,3 +168,4 @@ signing_key:
|
|
167
168
|
specification_version: 4
|
168
169
|
summary: Shared snippets for ass_ole gem
|
169
170
|
test_files: []
|
171
|
+
has_rdoc:
|