Class: RuBB::Node::Email
- Inherits:
-
RuBB::Node
- Object
- RuBB::Node
- RuBB::Node::Email
- Defined in:
- lib/rubb/node/email.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
Attributes inherited from RuBB::Node
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Email
constructor
A new instance of Email.
- #to_html ⇒ Object
Methods inherited from RuBB::Node
Constructor Details
#initialize(options = {}) ⇒ Email
Returns a new instance of Email.
6 7 8 9 |
# File 'lib/rubb/node/email.rb', line 6 def initialize(={}) super() @email = [:email] || '' end |
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/rubb/node/email.rb', line 4 def email @email end |
Instance Method Details
#to_html ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rubb/node/email.rb', line 11 def to_html unless(@email.empty?) html = "<a href=\"mailto:#{Parser.escape_quotes(@email)}\">" @children.each do |child| html += child ? child.to_html : '' end html + '</a>' else email = Parser.escape_quotes(@children.map {|c| c ? c.to_html : '' }.join) html = "<a href=\"mailto:#{email}\">#{email}</a>" end end |