Sha256: ea739605a008a6158c84c325e9480236e2a53ca414de12ed3afae276f6fa5c0b

Contents?: true

Size: 580 Bytes

Versions: 4

Compression:

Stored size: 580 Bytes

Contents

# -*- coding: utf-8 -*-

module SmalrubyEditor
  # app/assets以下のJavaScriptからBlocklyのメッセージを扱いやすくするた
  # めのヘルパーモジュール
  module BlocklyMessageHelper
    def bm(name)
      if /\A\./ =~ name
        md = /(.*?):(?:\d+)/.match(caller[0])
        filename = md[1]
        prefix = filename.slice(%r"app/assets/javascripts/(.*)$", 1)
          .gsub(/\..*\z/, '')
        name = (prefix + name).gsub(/[\/.]/, '_')
      end
      "Smalruby.bm('#{name.upcase}')"
    end
  end
end

include SmalrubyEditor::BlocklyMessageHelper

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smalruby-editor-0.1.24-x86-mingw32 lib/smalruby_editor/blockly_message_helper.rb
smalruby-editor-0.1.24 lib/smalruby_editor/blockly_message_helper.rb
smalruby-editor-0.1.23-x86-mingw32 lib/smalruby_editor/blockly_message_helper.rb
smalruby-editor-0.1.23 lib/smalruby_editor/blockly_message_helper.rb