Skip to content

Commit 73ab44d

Browse files
committed
WeDoを追加しました
1 parent 8ebaba3 commit 73ab44d

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/lib/ruby-generator/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import MakeyMakeyBlocks from './makeymakey.js';
2525
import MicrobitBlocks from './microbit.js';
2626
import BoostBlocks from './boost.js';
2727
import EV3Blocks from './ev3.js'
28+
import WeDo2Blocks from './wedo2.js';
2829

2930
const SCALAR_TYPE = '';
3031
const LIST_TYPE = 'list';
@@ -452,5 +453,6 @@ MakeyMakeyBlocks(RubyGenerator);
452453
MicrobitBlocks(RubyGenerator);
453454
BoostBlocks(RubyGenerator);
454455
EV3Blocks(RubyGenerator);
456+
WeDo2Blocks(RubyGenerator);
455457

456458
export default RubyGenerator;

src/lib/ruby-generator/wedo2.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Define Ruby code generator for WeDo 2.0 Blocks
3+
* @param {RubyGenerator} Generator The RubyGenerator
4+
* @return {RubyGenerator} same as param.
5+
*/
6+
export default function (Generator) {
7+
Generator.wedo2_getDistance = function (block) {
8+
return [`wedo2_distance`, Generator.ORDER_ATOMIC];
9+
};
10+
11+
return Generator;
12+
}

0 commit comments

Comments
 (0)