Sha256: d1848fdd2a6bc783c0dcb4e6473698c2323435860a167a5b3d26cbb99e235339

Contents?: true

Size: 1 KB

Versions: 46

Compression:

Stored size: 1 KB

Contents

# Blocklyが提供しているブロック

<% category = 'math' %>

<% n = "#{category}_number" %>
Blockly.Ruby['<%= n %>'] = (block) ->
  code = parseFloat(@getFieldValue('NUM'))
  order = if code < 0 then Blockly.Ruby.ORDER_UNARY_MINUS_SIGN else Blockly.Ruby.ORDER_ATOMIC
  [code, order]


<% category = 'text' %>

<% n = "#{category}" %>
Blockly.Ruby['<%= n %>'] = (block) ->
  code = Blockly.Ruby.quote_(@getFieldValue('TEXT'))
  [code, Blockly.Ruby.ORDER_ATOMIC]


# 変数
<% category = 'variables' %>

# [▼](変数)
<% n = "#{category}_get" %>
Blockly.Ruby['<%= n %>'] = (block) ->
  name = Blockly.Ruby.variableDB_.getName(block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE)
  [name, Blockly.Ruby.ORDER_ATOMIC]

# セット[▼]宛先
<% n = "#{category}_set" %>
Blockly.Ruby['<%= n %>'] = (block) ->
  val = Blockly.Ruby.valueToCode(block, 'VALUE', Blockly.Ruby.ORDER_NONE) || '0'
  name = Blockly.Ruby.variableDB_.getName(block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE)
  name + ' = ' + val + '\n'

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
smalruby-editor-0.4.1-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.4.2-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.4.2 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.4.1 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.4.0-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.4.0 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.5-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.5 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.4-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.4 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.3-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.3 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.2-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.2 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.1-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.1 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.0-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.3.0 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.2.7-x86-mingw32 app/assets/javascripts/blocks/blockly.js.coffee.erb
smalruby-editor-0.2.7 app/assets/javascripts/blocks/blockly.js.coffee.erb