Class: RubyToBlock::Block::SoundPresetSounds

Inherits:
Value
  • Object
show all
Defined in:
app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb

Constant Summary collapse

SOUNDS =

TODO: 自動生成する

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

Constants inherited from Base

Base::STRING_RE

Instance Attribute Summary

Attributes inherited from Base

#fields, #parent, #prev_sibling, #sibling, #statements, #values

Class Method Summary collapse

Methods inherited from Base

#[], #add_statement, #add_value, blocknize, indent?, #indent_level, inherited, #initialize, inline?, #inline?, #null?, priority, process_else, process_end, process_value_string, regexp, statement?, #to_xml, type, #type, value?

Constructor Details

This class inherits a constructor from RubyToBlock::Block::Base

Class Method Details

.process_match_data(md, context) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'app/models/concerns/ruby_to_block/block/sound_preset_sounds.rb', line 19

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