Class: SsSyntax::Parses::HeartVoice

Inherits:
Object
  • Object
show all
Defined in:
lib/ss_syntax/parses/heart_voice.rb

Class Method Summary collapse

Class Method Details

.check(text) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/ss_syntax/parses/heart_voice.rb', line 4

def self.check(text)
  if text.match(/.+_/)
    return true
  end

  return false
end

.get(text, characters) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/ss_syntax/parses/heart_voice.rb', line 12

def self.get(text, characters)
  match = text.match(/(.+)_ (.+)/)
  key, body = match[1], match[2]

  return "#{characters[key]}#{body}" if characters[key] != nil
  return "#{key}#{body}"
end