dfhmdf 0.0.1 → 0.0.2
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 +4 -4
- data/README.md +16 -11
- data/dfhmdf.gemspec +1 -0
- data/lib/convert_dfhmdf.rb +1 -5
- data/lib/dfhmdf.rb +61 -31
- data/lib/dfhmdf/version.rb +1 -1
- data/spec/lib/dfhmdf/convert_dfhmdf_spec.rb +18 -5
- data/spec/lib/dfhmdf/dfhmdf_spec.rb +33 -31
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9348a12cf9fb46196a9be3484938e13f3f1d6e69
|
4
|
+
data.tar.gz: 55b130e157490eee7f4f85a76cdb6dc166b168e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd0be31ab9f0c55fe934776d404f2a807f888e73738c21e39707c4003d6eebe91bfbc967cf8aa239b85c84e4937b04564cbdf840e6b55faf0ff907735d4646f5
|
7
|
+
data.tar.gz: e4d44fe0f1646e974d8719b926e558ba07682e7f148aa3b024026acf9cc01243cc66eb84c8acdb2fefedf100fa3eca34201677f14978469c18d3f2b7b4e5d4d9
|
data/README.md
CHANGED
@@ -1,29 +1,30 @@
|
|
1
1
|
# dfhmdf
|
2
2
|
|
3
|
-
Converts DFHMDF macro specifications into ```text_field``` definitions for use with the (https://github.com/cheezy/te3270/)
|
3
|
+
Converts DFHMDF macro specifications into ```text_field``` definitions for use with the [TE3270 gem](https://github.com/cheezy/te3270/). The purpose is to eliminate the need for you to count the characters across and down a 3270 screen to determine the X and Y coordinates and the length of each field you wish to define for TE3270.
|
4
4
|
|
5
5
|
## Example
|
6
6
|
|
7
|
-
Given a BMS macro source file named ```
|
7
|
+
Given a BMS macro source file named ```macro-source``` with the following contents:
|
8
8
|
|
9
9
|
```
|
10
10
|
QCKSET DFHMSD TYPE=MAP,STORAGE=AUTO,MODE=OUT,LANG=COBOL,TIOAPFX=YES
|
11
11
|
QCKMAP DFHMDI SIZE=(24,80),LINE=1,COLUMN=1,CTRL=ALARM
|
12
12
|
DFHMDF POS=(1,1),LENGTH=3,ATTRB=(ASKIP,BRT),INITIAL='QCK'
|
13
|
-
|
13
|
+
TITLE DFHMDF POS=(1,26),LENGTH=28,ATTRB=(ASKIP,NORM), X
|
14
14
|
INITIAL='Quick Customer Account Check'
|
15
|
-
|
15
|
+
HEAD DFHMDF POS=(3,1),LENGTH=8,ATTRB=(ASKIP,NORM),INITIAL='Account:'
|
16
16
|
ACCTNO DFHMDF POS=(3,13),LENGTH=7,ATTRB=(ASKIP,NORM)
|
17
17
|
DFHMDF POS=(4,1),LENGTH=5,ATTRB=(ASKIP,NORM),INITIAL='Name:'
|
18
18
|
SURNAME DFHMDF POS=(4,13),LENGTH=15,ATTRB=(ASKIP,NORM)
|
19
19
|
FNAME DFHMDF POS=(4,30),LENGTH=10,ATTRB=(ASKIP,NORM)
|
20
|
-
DFHMDF POS=(5,1),LENGTH=11,ATTRB=(ASKIP,NORM),
|
20
|
+
DFHMDF POS=(5,1),LENGTH=11,ATTRB=(ASKIP,NORM), X
|
21
|
+
INITIAL='Max charge:'
|
21
22
|
CHG DFHMDF POS=(5,13),ATTRB=(ASKIP,NORM),PICOUT='$,$$0.00'
|
22
23
|
MSG DFHMDF LENGTH=20,POS=(7,1),ATTRB=(ASKIP,NORM)
|
23
24
|
DFHMSD TYPE=FINAL
|
24
25
|
```
|
25
26
|
|
26
|
-
run ```dfhmdf
|
27
|
+
run ```dfhmdf``` as a command-line utility:
|
27
28
|
|
28
29
|
```sh
|
29
30
|
dfhmdf macro-source > target-file
|
@@ -32,11 +33,15 @@ dfhmdf macro-source > target-file
|
|
32
33
|
to produce the following output:
|
33
34
|
|
34
35
|
```ruby
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
text_field(:x2y1, 1, 2, 3)
|
37
|
+
text_field(:title, 1, 27, 28)
|
38
|
+
text_field(:head, 3, 2, 8)
|
39
|
+
text_field(:x5y1, 4, 2, 5)
|
40
|
+
text_field(:surname, 4, 14, 15)
|
41
|
+
text_field(:fname, 4, 31, 10)
|
42
|
+
text_field(:x6y1, 5, 2, 11)
|
43
|
+
text_field(:chg, 5, 14, 8)
|
44
|
+
text_field(:msg, 7, 2, 20)
|
40
45
|
```
|
41
46
|
|
42
47
|
From the example you may surmise:
|
data/dfhmdf.gemspec
CHANGED
data/lib/convert_dfhmdf.rb
CHANGED
@@ -32,13 +32,9 @@ class ConvertDfhmdf
|
|
32
32
|
@macro_source
|
33
33
|
end
|
34
34
|
|
35
|
-
def process_macro dfhmdf_macro
|
36
|
-
parse_tokens tokenize_line dfhmdf_macro
|
37
|
-
end
|
38
|
-
|
39
35
|
def squish str
|
40
36
|
str[71] = ' ' unless str.length < 72
|
41
|
-
str.split.join(' ')
|
37
|
+
str[0..70].split.join(' ')
|
42
38
|
end
|
43
39
|
|
44
40
|
def macro_source
|
data/lib/dfhmdf.rb
CHANGED
@@ -1,41 +1,60 @@
|
|
1
1
|
module Dfhmdf
|
2
2
|
|
3
|
+
# Generate a te3270 text_field declaration using values parsed from a DFHMDF macro.
|
3
4
|
def te3270_text_field
|
4
|
-
"text_field(:#{field_label}, #{
|
5
|
+
"text_field(:#{field_label}, #{line_position}, #{column_position}, #{field_length})"
|
5
6
|
end
|
6
7
|
|
8
|
+
# Clear variables to prepare for parsing a DFHMDF macro.
|
7
9
|
def clear
|
8
10
|
@field_label, @parameter_hash, @parameters, @tokens = nil
|
9
11
|
@dfhmdf = false
|
10
12
|
end
|
11
13
|
|
12
|
-
def tokenize_line input_line
|
13
14
|
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
15
|
+
# Tokenize an input line from the macro source file.
|
16
|
+
#
|
17
|
+
# LABEL MACRO OPERAND,OPERAND,OPERAND COMMENT X
|
18
|
+
# 1 2 3 4 discard
|
19
|
+
def tokenize_line input_line
|
20
|
+
# Want to split on spaces except when space occurs within single quotes.
|
21
|
+
# Should be able to do it with a regex. Unable to figure it out so far. Using brute force.
|
22
|
+
# This regex doesn't work but was as close as I was able to get.
|
23
|
+
# @tokens = [@tokens, input_line.scan(/'.*?'|".*?"|\S+/)].compact.reduce([], :|)
|
24
|
+
# +input_line+:: A line of input from the macro source file.
|
18
25
|
|
19
26
|
new_tokens = []
|
20
27
|
temp = input_line.split
|
28
|
+
new_tokens[0] = temp[0]
|
29
|
+
if temp[0] == 'DFHMDF'
|
30
|
+
start_ix = 1
|
31
|
+
else
|
32
|
+
start_ix = 2
|
33
|
+
new_tokens[1] = temp[1]
|
34
|
+
end
|
35
|
+
temp = input_line.split(' ')
|
36
|
+
open_quote = false
|
21
37
|
for i in 0..temp.length-1 do
|
22
38
|
if temp[i] != nil
|
23
|
-
|
24
|
-
|
25
|
-
temp[i
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
39
|
+
open_quote = true unless temp[i].count("'") % 2 == 0
|
40
|
+
while open_quote
|
41
|
+
if temp[i+1] != nil
|
42
|
+
temp[i] << ' ' << temp[i+1]
|
43
|
+
temp[i+1] = nil
|
44
|
+
temp.compact!
|
45
|
+
open_quote = false if temp[i].count("'") % 2 == 0
|
46
|
+
else
|
47
|
+
open_quote = false
|
48
|
+
end
|
33
49
|
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
@tokens = [@tokens,
|
50
|
+
end
|
51
|
+
end
|
52
|
+
@tokens = [@tokens, temp].compact.reduce([], :|)
|
37
53
|
end
|
38
54
|
|
55
|
+
# Look at the tokens that were extracted from an input line and determine whether
|
56
|
+
# we are reading a DFHMDF macro. There may or may not be a label (1st token).
|
57
|
+
# +tokens+:: array of tokens extracted from the current input line
|
39
58
|
def parse_tokens tokens
|
40
59
|
@dfhmdf = false
|
41
60
|
if tokens[0] == 'DFHMDF'
|
@@ -52,9 +71,6 @@ module Dfhmdf
|
|
52
71
|
end
|
53
72
|
end
|
54
73
|
|
55
|
-
|
56
|
-
def parse_operands operands_as_string
|
57
|
-
#-----------------------------------------------------------------------------
|
58
74
|
# Parse the operands in a macro source statement:
|
59
75
|
#
|
60
76
|
# LABEL MACRO OPERAND,OPERAND,OPERAND COMMENT X
|
@@ -68,13 +84,12 @@ module Dfhmdf
|
|
68
84
|
# to this...
|
69
85
|
# { :pos => [ "6", "18" ], :length => "14", :attrb => [ "ASKIP", "NORM" ],
|
70
86
|
# :initial => "Hello there" }
|
71
|
-
|
87
|
+
# +operands_as_string+:: The DFHMDF operands as a single string.
|
88
|
+
def parse_operands operands_as_string
|
72
89
|
@operands_hash = {}
|
73
|
-
|
74
90
|
# Split on comma except when the comma appears within parentheses.
|
75
|
-
# Couldn't figure out how to make
|
91
|
+
# Couldn't figure out how to make regex ignore commas within single quotes,
|
76
92
|
# so it misses PICOUT='$,$$0.00' and similar. Using brute force to handle it.
|
77
|
-
|
78
93
|
item = operands_as_string.split(/,(?![^(]*\))/)
|
79
94
|
for i in 0..item.length-1
|
80
95
|
if item[i].match(/^PICOUT=/)
|
@@ -101,24 +116,39 @@ module Dfhmdf
|
|
101
116
|
@operands_hash
|
102
117
|
end
|
103
118
|
|
104
|
-
|
105
|
-
|
119
|
+
|
120
|
+
# Return the line position of the field as specified in the POS=(line, column) operand of DFHMDF.
|
121
|
+
# If the position has not been set, return zero.
|
122
|
+
def line_position
|
123
|
+
(@operands_hash != nil && @operands_hash[:pos] && @operands_hash[:pos][0].to_i) || 0
|
106
124
|
end
|
107
125
|
|
108
|
-
|
109
|
-
|
126
|
+
|
127
|
+
# Return the column position of the field as specified in the POS=(row, column) operand of DFHMDF.
|
128
|
+
# Increment the value by 1 to bypass the attribute byte.
|
129
|
+
# If the value has not been set, return zero.
|
130
|
+
def column_position
|
131
|
+
(@operands_hash != nil && @operands_hash[:pos] && @operands_hash[:pos][1].to_i + 1) || 0
|
110
132
|
end
|
111
133
|
|
134
|
+
|
135
|
+
# Return the length of the field. This may be specified in the LENGTH= operand of DFHMDF or
|
136
|
+
# derived from the PICOUT= or INTIAL= operand.
|
112
137
|
def field_length
|
113
138
|
(@operands_hash != nil && @operands_hash[:length] && @operands_hash[:length].to_i) ||
|
114
139
|
(@operands_hash != nil && @operands_hash[:initial] && @operands_hash[:initial].length) ||
|
115
140
|
(@operands_hash != nil && @operands_hash[:picout] && @operands_hash[:picout].length) || 0
|
116
141
|
end
|
117
142
|
|
143
|
+
|
144
|
+
# Return the field label (name) as specified on the DFHMDF macro. When no label is coded on
|
145
|
+
# the macro, build a name based on the X and Y coordinates, like x20y5 or x9y32.
|
118
146
|
def field_label
|
119
|
-
(@field_label == nil && "x#{
|
147
|
+
(@field_label == nil && "x#{line_position}y#{column_position}") || @field_label
|
120
148
|
end
|
121
149
|
|
150
|
+
|
151
|
+
# True if we are looking at a DFHMDF macro in the input.
|
122
152
|
def dfhmdf?
|
123
153
|
@dfhmdf
|
124
154
|
end
|
data/lib/dfhmdf/version.rb
CHANGED
@@ -11,16 +11,16 @@ describe ConvertDfhmdf do
|
|
11
11
|
@screen_def.process_macro 'SURNAME DFHMDF POS=(4,13),LENGTH=15,ATTRB=(ASKIP,NORM)'
|
12
12
|
expect(@screen_def.dfhmdf?).to be(true)
|
13
13
|
expect(@screen_def.field_label).to eq('surname')
|
14
|
-
expect(@screen_def.
|
15
|
-
expect(@screen_def.
|
14
|
+
expect(@screen_def.line_position).to eq(4)
|
15
|
+
expect(@screen_def.column_position).to eq(14)
|
16
16
|
expect(@screen_def.field_length).to eq(15)
|
17
17
|
end
|
18
18
|
it "ignores macros other than DFHMDF" do
|
19
19
|
@screen_def.process_macro 'QCKSET DFHMSD TYPE=MAP,STORAGE=AUTO,MODE=OUT,LANG=COBOL,TIOAPFX=YES'
|
20
20
|
expect(@screen_def.dfhmdf?).to be(false)
|
21
21
|
expect(@screen_def.field_label).to eq('x0y0')
|
22
|
-
expect(@screen_def.
|
23
|
-
expect(@screen_def.
|
22
|
+
expect(@screen_def.line_position).to eq(0)
|
23
|
+
expect(@screen_def.column_position).to eq(0)
|
24
24
|
expect(@screen_def.field_length).to eq(0)
|
25
25
|
end
|
26
26
|
end
|
@@ -32,7 +32,7 @@ describe ConvertDfhmdf do
|
|
32
32
|
expect(@screen_def.macro_source).to eq('SURNAME DFHMDF POS=(4,13),LENGTH=15,ATTRB=(ASKIP,NORM)')
|
33
33
|
end
|
34
34
|
|
35
|
-
it "stores macro source coded on multiple lines" do
|
35
|
+
it "stores macro source coded on multiple lines, POS first" do
|
36
36
|
allow(@screen_def).to receive(:read_line).and_return(
|
37
37
|
# 1 2 3 4 5 6 7 8
|
38
38
|
# 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
@@ -44,6 +44,19 @@ describe ConvertDfhmdf do
|
|
44
44
|
expect(@screen_def.macro_source)
|
45
45
|
.to eq('SURNAME DFHMDF POS=(4,13),LENGTH=15,ATTRB=(ASKIP,NORM),INITIAL=\'Name here\'')
|
46
46
|
end
|
47
|
+
|
48
|
+
it "stores macro source coded on multiple lines, INITIAL first" do
|
49
|
+
allow(@screen_def).to receive(:read_line).and_return(
|
50
|
+
# 1 2 3 4 5 6 7 8
|
51
|
+
# 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
52
|
+
'SURNAME DFHMDF INITIAL=\'Name here\', X',
|
53
|
+
' LENGTH=15, X',
|
54
|
+
' ATTRB=(ASKIP,NORM), X',
|
55
|
+
' POS=(4,13)')
|
56
|
+
@screen_def.ingest_macro
|
57
|
+
expect(@screen_def.macro_source)
|
58
|
+
.to eq('SURNAME DFHMDF INITIAL=\'Name here\',LENGTH=15,ATTRB=(ASKIP,NORM),POS=(4,13)')
|
59
|
+
end
|
47
60
|
end
|
48
61
|
|
49
62
|
end
|
@@ -25,8 +25,8 @@ describe ScreenDef do
|
|
25
25
|
expect(@screen_def.dfhmdf?).to be(false)
|
26
26
|
expect(@screen_def.field_length).to eq(0)
|
27
27
|
expect(@screen_def.field_label).to eq('x0y0')
|
28
|
-
expect(@screen_def.
|
29
|
-
expect(@screen_def.
|
28
|
+
expect(@screen_def.line_position).to eq(0)
|
29
|
+
expect(@screen_def.column_position).to eq(0)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -43,8 +43,13 @@ describe ScreenDef do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "splits properly when the last operand is a quoted string with a space" do
|
46
|
-
expect(@screen_def.tokenize_line("abc de,'
|
47
|
-
.to eq([ "abc", "de,'
|
46
|
+
expect(@screen_def.tokenize_line("abc de,fghi,'jkl mnop'"))
|
47
|
+
.to eq([ "abc", "de,fghi,'jkl mnop'" ])
|
48
|
+
end
|
49
|
+
|
50
|
+
it "splits properly when an operand has multiple embedded spaces" do
|
51
|
+
expect(@screen_def.tokenize_line("abc de,'fg hi jk',lmn"))
|
52
|
+
.to eq([ "abc", "de,'fg hi jk',lmn" ])
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -55,31 +60,23 @@ describe ScreenDef do
|
|
55
60
|
@screen_def.parse_tokens([ 'DFHMDF', 'POS=(4,5),LENGTH=15', 'baz' ])
|
56
61
|
expect(@screen_def.dfhmdf?).to be(true)
|
57
62
|
end
|
58
|
-
end
|
59
63
|
|
60
|
-
describe "#parse_tokens" do
|
61
64
|
it "clears the previous value of field label when none is specified" do
|
62
65
|
@screen_def.field_label = 'aardvaark'
|
63
66
|
@screen_def.parse_tokens([ 'DFHMDF', 'foo', 'bar' ])
|
64
67
|
expect(@screen_def.field_label).to eql('x0y0')
|
65
68
|
end
|
66
|
-
end
|
67
69
|
|
68
|
-
describe "#parse_tokens" do
|
69
70
|
it "recognizes a DFHMDF macro with a label" do
|
70
71
|
@screen_def.parse_tokens([ 'FIELDNAME', 'DFHMDF', 'POS=(4,5),LENGTH=15', 'bar' ])
|
71
72
|
expect(@screen_def.dfhmdf?).to be(true)
|
72
73
|
end
|
73
|
-
end
|
74
74
|
|
75
|
-
describe "#parse_tokens" do
|
76
75
|
it "populates the field label when one is specified" do
|
77
76
|
@screen_def.parse_tokens([ 'FIELDNAME', 'DFHMDF', 'POS=(4,5),LENGTH=15', 'bar' ])
|
78
77
|
expect(@screen_def.field_label).to eq('fieldname')
|
79
78
|
end
|
80
|
-
end
|
81
79
|
|
82
|
-
describe "#parse_tokens" do
|
83
80
|
it "ignores source lines that do not contain a DFHMDF macro" do
|
84
81
|
@screen_def.parse_tokens [ 'foo', 'bar', 'DFHMDF', 'baz' ]
|
85
82
|
expect(@screen_def.dfhmdf?).to eq(false)
|
@@ -104,10 +101,15 @@ describe ScreenDef do
|
|
104
101
|
.to eq({ :key1 => [ "one", "two" ], :key2 => [ "three", "four" ] })
|
105
102
|
end
|
106
103
|
|
107
|
-
it "handles
|
104
|
+
it "handles operands in the order pos, length, attrb, initial" do
|
108
105
|
expect(@screen_def.parse_operands("POS=(6,18),LENGTH=14,ATTRB=(ASKIP,NORM),INITIAL='Hello there'"))
|
109
106
|
.to eq({ :pos => [ "6", "18" ], :length => "14", :attrb => [ "ASKIP", "NORM" ], :initial => "Hello there" })
|
110
107
|
end
|
108
|
+
|
109
|
+
it "handles operands in the order length, attrb, initial, pos" do
|
110
|
+
expect(@screen_def.parse_operands("LENGTH=14,ATTRB=(ASKIP,NORM),INITIAL='Hello there',POS=(6,18)"))
|
111
|
+
.to eq({ :pos => [ "6", "18" ], :length => "14", :attrb => [ "ASKIP", "NORM" ], :initial => "Hello there" })
|
112
|
+
end
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
@@ -118,44 +120,44 @@ describe ScreenDef do
|
|
118
120
|
expect(@screen_def.field_label).to eq('NAME')
|
119
121
|
end
|
120
122
|
|
121
|
-
it "derives a field label based on
|
123
|
+
it "derives a field label based on line and column positions when no label was specified" do
|
122
124
|
@screen_def.field_label = nil
|
123
125
|
@screen_def.operands_hash( { :pos => [ "5", "18" ] })
|
124
|
-
expect(@screen_def.field_label).to eq('
|
126
|
+
expect(@screen_def.field_label).to eq('x5y19')
|
125
127
|
end
|
126
128
|
end
|
127
129
|
end
|
128
130
|
|
129
131
|
context "determining field position" do
|
130
|
-
describe "#
|
131
|
-
it "returns 0 as the
|
132
|
-
expect(@screen_def.
|
132
|
+
describe "#line_position" do
|
133
|
+
it "returns 0 as the line if the position has not been determined" do
|
134
|
+
expect(@screen_def.line_position).to eq(0)
|
133
135
|
end
|
134
136
|
|
135
|
-
it "returns 0 as the
|
137
|
+
it "returns 0 as the line if POS=(line,column)) was not specified" do
|
136
138
|
@screen_def.operands_hash( { :foo => "bar" } )
|
137
|
-
expect(@screen_def.
|
139
|
+
expect(@screen_def.line_position).to eq(0)
|
138
140
|
end
|
139
141
|
|
140
|
-
it "calculates the
|
142
|
+
it "calculates the column position value skipping the attribute byte" do
|
141
143
|
@screen_def.operands_hash( { :pos => ["5", "28"] } )
|
142
|
-
expect(@screen_def.
|
144
|
+
expect(@screen_def.line_position).to eq(5)
|
143
145
|
end
|
144
146
|
end
|
145
147
|
|
146
|
-
describe "#
|
148
|
+
describe "#column_position" do
|
147
149
|
it "returns 0 as the y coordinate if the position has not been determined" do
|
148
|
-
expect(@screen_def.
|
150
|
+
expect(@screen_def.column_position).to eq(0)
|
149
151
|
end
|
150
152
|
|
151
|
-
it "returns 0 as the
|
153
|
+
it "returns 0 as the column position if POS=(line,column)) was not specified" do
|
152
154
|
@screen_def.operands_hash( { :foo => "bar" } )
|
153
|
-
expect(@screen_def.
|
155
|
+
expect(@screen_def.column_position).to eq(0)
|
154
156
|
end
|
155
157
|
|
156
|
-
it "returns the
|
158
|
+
it "returns the column position value from the POS=(line,column)) parameter" do
|
157
159
|
@screen_def.operands_hash( { :pos => ["5", "28"] } )
|
158
|
-
expect(@screen_def.
|
160
|
+
expect(@screen_def.column_position).to eq(29)
|
159
161
|
end
|
160
162
|
end
|
161
163
|
end
|
@@ -189,19 +191,19 @@ describe ScreenDef do
|
|
189
191
|
it "generates a text_field definition for a field with a LENGTH= specification" do
|
190
192
|
@screen_def.field_label = 'myfield'
|
191
193
|
@screen_def.operands_hash({ :pos => [ "23", "6" ], :length => "14" })
|
192
|
-
expect(@screen_def.te3270_text_field).to eql('text_field(:myfield,
|
194
|
+
expect(@screen_def.te3270_text_field).to eql('text_field(:myfield, 23, 7, 14)')
|
193
195
|
end
|
194
196
|
|
195
197
|
it "generates a text_field definition for a field with a PICOUT= specification" do
|
196
198
|
@screen_def.field_label = 'otherfld'
|
197
199
|
@screen_def.operands_hash({ :pos => [ "8", "16" ], :picout => "$$,$$0.00" })
|
198
|
-
expect(@screen_def.te3270_text_field).to eql('text_field(:otherfld,
|
200
|
+
expect(@screen_def.te3270_text_field).to eql('text_field(:otherfld, 8, 17, 9)')
|
199
201
|
end
|
200
202
|
|
201
203
|
it "generates a text_field definition for a field with INITIAL= and no LENGTH=" do
|
202
204
|
@screen_def.field_label = 'otherfld'
|
203
205
|
@screen_def.operands_hash({ :pos => [ "8", "16" ], :initial => "Hello" })
|
204
|
-
expect(@screen_def.te3270_text_field).to eql('text_field(:otherfld,
|
206
|
+
expect(@screen_def.te3270_text_field).to eql('text_field(:otherfld, 8, 17, 5)')
|
205
207
|
end
|
206
208
|
end
|
207
209
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dfhmdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Nicolette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: Generate text_field specifications for te3270 based on DFHMDF source
|
42
56
|
email:
|
43
57
|
- davenicolette@gmail.com
|