Sha256: 3ac51e0b57765c5ee8fa94507fe50a9147e9352e2fff956d9a19d0721022f2ff
Contents?: true
Size: 1.93 KB
Versions: 30
Compression:
Stored size: 1.93 KB
Contents
# 「Ruby」ジャンル <% category = 'ruby' require 'smalruby_editor' require 'smalruby_editor/blockly_message_helper' color = SmalrubyEditor::COLORS[category.to_sym] %> # 文 <% n = "#{category}_statement" %> Blockly.Blocks['<%= n %>'] = init: ()-> @setHelpUrl('') @setColour(<%= color %>) @appendDummyInput() .appendField(<%= bm('.statement') %>) .appendField(new Blockly.FieldTextInput(''), 'STATEMENT') @setPreviousStatement(true) @setNextStatement(true) @setTooltip('') Blockly.Ruby['<%= n %>'] = (block) -> statement = @getFieldValue('STATEMENT') "#{statement}\n" # 式 <% n = "#{category}_expression" %> Blockly.Blocks['<%= n %>'] = init: ()-> @setHelpUrl('') @setColour(<%= color %>) @appendDummyInput() .appendField(<%= bm('.expression') %>) .appendField(new Blockly.FieldTextInput(''), 'EXP') @setOutput(true, null) @setTooltip('') Blockly.Ruby['<%= n %>'] = (block) -> exp = @getFieldValue('EXP') ["(#{exp})", Blockly.Ruby.ORDER_ATOMIC] # コメント <% n = "#{category}_comment" %> Blockly.Blocks['<%= n %>'] = init: ()-> @setHelpUrl('') @setColour(<%= color %>) @appendDummyInput() .appendField(<%= bm('.comment') %>) .appendField(new Blockly.FieldTextInput(''), 'COMMENT') @setPreviousStatement(true) @setNextStatement(true) @setTooltip('') Blockly.Ruby['<%= n %>'] = (block) -> comment = @getFieldValue('COMMENT') "# #{comment}\n" # p <% n = "#{category}_p" %> Blockly.Blocks['<%= n %>'] = init: ()-> @setHelpUrl('') @setColour(<%= color %>) @interpolateMsg(<%= bm('.p') %>, ['ARG', null, Blockly.ALIGN_RIGHT], Blockly.ALIGN_RIGHT) @setInputsInline(true) @setPreviousStatement(true) @setNextStatement(true) @setTooltip('') Blockly.Ruby['<%= n %>'] = (block) -> arg = Blockly.Ruby.valueToCode(@, 'ARG', Blockly.Ruby.ORDER_NONE) || '""' "p(#{arg})\n"
Version data entries
30 entries across 30 versions & 1 rubygems