Class: SsSyntax::Parse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text) ⇒ Parse

Returns a new instance of Parse.



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

def initialize(text)
  @text = text
  @charactes = {}
  @parse_text = parse_text
end

Instance Attribute Details

#charactersObject (readonly)

Returns the value of attribute characters.



10
11
12
# File 'lib/ss_syntax/parse.rb', line 10

def characters
  @characters
end

#textObject (readonly)

Returns the value of attribute text.



10
11
12
# File 'lib/ss_syntax/parse.rb', line 10

def text
  @text
end

Instance Method Details

#to_hObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ss_syntax/parse.rb', line 22

def to_h
  html_text = ''
  @parse_text.each_line do |line|
    line.chomp!
    
    if line != ''
      html_text += "<p>#{line}</p>"
    else 
      html_text += "<br />"
    end
  end

  html_text
end

#to_sObject



18
19
20
# File 'lib/ss_syntax/parse.rb', line 18

def to_s
  @parse_text
end