Class: SsSyntax::Parses::Character

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

Class Method Summary collapse

Class Method Details

.check(text) ⇒ Object



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

def self.check(text)
  if text.match(/^\*/) || text.match(/^-/)
    return true
  end

  return false
end

.get(text) ⇒ Object



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

def self.get(text)
  match = text.match(/^\* (.+) (.+)/) || text.match(/^- (.+) (.+)/)
  return nil, nil if match == nil # TODO: raiseしてあげた方がいいかも
  return match[1], match[2]
end