Class: Flammarion::Writeable::Paragraph

Inherits:
Object
  • Object
show all
Defined in:
lib/cem/cflame/p.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, name, owner) ⇒ Paragraph

Returns a new instance of Paragraph.



9
10
11
12
13
# File 'lib/cem/cflame/p.rb', line 9

def initialize(text, name, owner)
  @text = text
  @name = name
  @owner = owner
end

Instance Method Details

#htmlObject



15
16
17
# File 'lib/cem/cflame/p.rb', line 15

def html
  %|<p id="#{@name}">#{@text}</p>|  
end

#text=(newText) ⇒ Object



23
24
25
26
27
28
# File 'lib/cem/cflame/p.rb', line 23

def text=(newText)
  return if newText == @text
  @text = newText    
  
  @owner.js("$( '##{@name}' ).replaceWith('#{html}');")
end

#to_sObject



19
20
21
# File 'lib/cem/cflame/p.rb', line 19

def to_s
  html
end