Skip to content

Commit f1755e1

Browse files
committed
WeDoを追加しました
1 parent 52673a1 commit f1755e1

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
@@ -23,6 +23,7 @@ import Text2SpeechBlocks from './text2speech.js';
2323
import TranslateBlocks from './translate.js';
2424
import MakeyMakeyBlocks from './makeymakey.js';
2525
import MicrobitBlocks from './microbit.js';
26+
import WeDo2Blocks from './wedo2.js';
2627

2728
const SCALAR_TYPE = '';
2829
const LIST_TYPE = 'list';
@@ -448,5 +449,6 @@ Text2SpeechBlocks(RubyGenerator);
448449
TranslateBlocks(RubyGenerator);
449450
MakeyMakeyBlocks(RubyGenerator);
450451
MicrobitBlocks(RubyGenerator);
452+
WeDo2Blocks(RubyGenerator);
451453

452454
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)