Sha256: 2ecff8d32890d43727235c182267732df904c1d4bd89fc7953687c452be6df7a

Contents?: true

Size: 703 Bytes

Versions: 69

Compression:

Stored size: 703 Bytes

Contents

# -*- coding: utf-8 -*-
module RubyToBlock
  module Block
    class SoundPresetSounds < Value
      blocknize '^\s*"([^"]*?\.wav)"\s*$', value: true, priority: 1

      # TODO: 自動生成する
      SOUNDS = %w(
        piano_do.wav
        piano_re.wav
        piano_mi.wav
        piano_fa.wav
        piano_so.wav
        piano_ra.wav
        piano_si.wav
        piano_do_2.wav
      )

      def self.process_match_data(md, context)
        md2 = regexp.match(md[type])
        if SOUNDS.include?(md2[1])
          context.add_value(new(fields: { NAME: md2[1] }))
        else
          context.add_value(Text.new(fields: { TEXT: md2[1] }))
        end

        true
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
smalruby-editor-0.4.1-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.4.2-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.4.2 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.4.1 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.4.0-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.4.0 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.5-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.5 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.4-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.4 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.3-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.3 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.2-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.2 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.1-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.1 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.0-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.3.0 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.2.7-x86-mingw32 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb
smalruby-editor-0.2.7 app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb