Class: SsSyntax::SsSyntax

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, type = :text) ⇒ SsSyntax

Returns a new instance of SsSyntax.



7
8
9
10
# File 'lib/ss_syntax.rb', line 7

def initialize(text, type = :text)
  @text = text
  @type = type
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



5
6
7
# File 'lib/ss_syntax.rb', line 5

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/ss_syntax.rb', line 5

def type
  @type
end

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ss_syntax.rb', line 12

def parse()
  parse = Parse.new(@text)
  case @type
    when :text
      return parse.to_s
    when :html
      return parse.to_h
    else
      return parse.to_s
  end
end