Class: HOM::NodeList

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

Instance Method Summary collapse

Constructor Details

#initialize(nodes) ⇒ NodeList

Returns a new instance of NodeList.



51
52
53
# File 'lib/hom.rb', line 51

def initialize(nodes)
  @nodes = Array(nodes)
end

Instance Method Details

#+(object) ⇒ Object



67
68
69
# File 'lib/hom.rb', line 67

def +(object)
  self.class.new(@nodes + Array(object))
end

#html_safe?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/hom.rb', line 55

def html_safe?
  true
end

#join(separator) ⇒ Object



71
72
73
# File 'lib/hom.rb', line 71

def join(separator)
  Encoding.safe_encode(intersperse(separator, @nodes))
end

#to_aObject



63
64
65
# File 'lib/hom.rb', line 63

def to_a
  @nodes
end

#to_sObject



59
60
61
# File 'lib/hom.rb', line 59

def to_s
  Encoding.safe_encode(self)
end