ladder_drive 0.6.2 → 0.6.3

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: db50d1258ad8884768107cbbabcc791facfc9098
4
- data.tar.gz: 2e822aa44401aea65ac329c661d2e31149bc450a
3
+ metadata.gz: ebbe6a801c62fb7bf390b50e904186de6c8a54d4
4
+ data.tar.gz: 65bc6883680145868f3bec1b333d76760fee2eb0
5
5
  SHA512:
6
- metadata.gz: db25c044845435a432c6341ec030a888412b00074fb831501b1dc768915d4bdeaee7df76d953d65e395a2b4305a43007a5a38373d8a5a35a572d57074ebc8c73
7
- data.tar.gz: 93e2bfa1422d6abb39b34791fbf0705ef734e4bf87464201ebc1bdbc5f56de133743ac13af8709886b2b3a532f34a6a97c5b59777074413c09b02dd2fe2d4468
6
+ metadata.gz: 2a78ed56aecb16bb8a4bdf5275acdf6b5f551cc62bce2efd6512160e79aa5c0d9757eb9eed6419f419bb5eba4f13fcc44e6ead4d4b9cc6cdb4cb4277b8ad150b
7
+ data.tar.gz: 885041e935159cc775be45f6f8d0d46a148f74739c7b24fea1ccf8c4f4e5627f3be0b0b1cbbdd2fb92c6176defefadb949e55cf8e25848a76d10dde54c577f49
@@ -184,7 +184,8 @@ module Mitsubishi
184
184
  def device_by_name name
185
185
  case name
186
186
  when String
187
- FxDevice.new name
187
+ d = FxDevice.new name
188
+ d.valid? ? d : nil
188
189
  when EscDevice
189
190
  local_device_of name
190
191
  else
@@ -164,7 +164,8 @@ module Mitsubishi
164
164
  def device_by_name name
165
165
  case name
166
166
  when String
167
- QDevice.new name
167
+ d = QDevice.new name
168
+ d.valid? ? d : nil
168
169
  when EscDevice
169
170
  local_device_of name
170
171
  else
@@ -25,7 +25,7 @@ module LadderDrive
25
25
  module Protocol
26
26
  module Mitsubishi
27
27
 
28
- class QDevice
28
+ class QDevice < PlcDevice
29
29
 
30
30
  attr_reader :suffix, :number
31
31
 
@@ -49,11 +49,10 @@ module Mitsubishi
49
49
  @suffix = [a[0,2].to_i(16), a[2,2].to_i(16)].pack "C*"
50
50
  @suffix.strip!
51
51
  @number = a[4,8].to_i(16)
52
- elsif /(X|Y)(.+)/i =~ a
52
+ elsif /(X|Y|B|W|SB|SW|DX|DY)([0-9a-f]+)/i =~ a
53
53
  @suffix = $1.upcase
54
54
  @number = $2.to_i(p_adic_number)
55
- else
56
- /(M|L|S|B|F|T|C|D|W|R|ZR)(.+)/i =~ a
55
+ elsif /(M|L|S|F|T|C|D|R|ZR)([0-9]+)/i =~ a
57
56
  @suffix = $1.upcase
58
57
  @number = $2.to_i(p_adic_number)
59
58
  end
@@ -61,6 +60,10 @@ module Mitsubishi
61
60
  end
62
61
  end
63
62
 
63
+ def valid?
64
+ !!@suffix && !!@number
65
+ end
66
+
64
67
  def p_adic_number
65
68
  case @suffix
66
69
  when "X", "Y", "B", "W", "SB", "SW", "DX", "DY"
@@ -22,5 +22,5 @@
22
22
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
23
 
24
24
  module LadderDrive
25
- VERSION = "0.6.2"
25
+ VERSION = "0.6.3"
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ladder_drive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katsuyoshi Ito
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-25 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor