smalruby 0.0.10-x86-mingw32 → 0.0.11-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of smalruby might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de1f38e041662e3951fc08a199e406f775c3393a
4
- data.tar.gz: 0bef6659dc38ff498f2efd6fd8d81ceb0383ce71
3
+ metadata.gz: 97f67453d379aa35debc94a5001717b9a9d5462a
4
+ data.tar.gz: 8e61b50a286045a95f1d17990ff7a67d0140dab1
5
5
  SHA512:
6
- metadata.gz: e1198cb4c12b92d0a730a4f169f29dd044c01c86865ac41bd404538990052155823f1ebf092a0e03655315756cf82bc2c4145e4e67078b0b58c6739149484942
7
- data.tar.gz: 765e084047bd46ea513252c3575c262a73c8bf9775bc3a859756482ec3e81f9a24f1d48d6b6df176ee587f37f3f8614edf2fb460cefbad9c66f2a48f5be0c6d5
6
+ metadata.gz: 48b3df938441ce028b9ef79d59769e035d33b07bba8e7ab412192e038d97bc9e16f13de77f4f39b5a5cec4a419e68dce8fb6aa0f1f198f3c79ace11864fac967
7
+ data.tar.gz: 4947ebb00dc75b53992c386ac1007bd622dd81bcdf65f62cae0051d1d503520aa365bb62faa4cc263ace67e4bf479877c40c34b597134dffbee1a6bb2a8e4502
data/.rubocop.yml CHANGED
@@ -37,3 +37,6 @@ StringLiterals:
37
37
 
38
38
  EndOfLine:
39
39
  Enabled: false
40
+
41
+ TrailingComma:
42
+ Enabled: false
@@ -6,6 +6,10 @@ module Smalruby
6
6
  module Pin
7
7
  module_function
8
8
 
9
+ DIO_DINO_RE = /\A([0-9]|1[0-3])\z/
10
+ DIO_SMALRUBY_RE = /\AD([0-9]|1[0-3])\z/
11
+ AI_RE = /\AA[0-5]\z/
12
+
9
13
  # Smalrubyのピン番号をDinoのピン番号に変換する
10
14
  #
11
15
  # ピン番号が0~13、D0~D13、A0~A5でなければ例外が発生する
@@ -16,11 +20,11 @@ module Smalruby
16
20
  def smalruby_to_dino(pin)
17
21
  pin = pin.to_s
18
22
  case pin
19
- when /\A[0-9]|1[0-3]\z/
23
+ when DIO_DINO_RE
20
24
  pin.to_i
21
- when /\AD[0-9]|D1[0-3]\z/
25
+ when DIO_SMALRUBY_RE
22
26
  pin[1..-1].to_i
23
- when /\AA[0-5]\z/
27
+ when AI_RE
24
28
  pin
25
29
  else
26
30
  fail "ハードウェアのピンの番号が間違っています: #{pin}"
@@ -36,11 +40,11 @@ module Smalruby
36
40
  def dino_to_smalruby(pin)
37
41
  pin = pin.to_s
38
42
  case pin
39
- when /\A[0-9]|1[0-3]\z/
43
+ when DIO_DINO_RE
40
44
  "D#{pin}"
41
- when /\AD[0-9]|D1[0-3]\z/
45
+ when DIO_SMALRUBY_RE
42
46
  pin
43
- when /\AA[0-5]\z/
47
+ when AI_RE
44
48
  pin
45
49
  else
46
50
  fail "ハードウェアのピンの番号が間違っています: #{pin}"
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module Smalruby
4
- VERSION = '0.0.10'
4
+ VERSION = '0.0.11'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Kouji Takao