Class: HOM::Entity

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Entity



9
10
11
# File 'lib/hom.rb', line 9

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#+(object) ⇒ Object



29
30
31
# File 'lib/hom.rb', line 29

def +(object)
  NodeList.new([self, object])
end

#html_safe?Boolean



25
26
27
# File 'lib/hom.rb', line 25

def html_safe?
  true
end

#named?Boolean



21
22
23
# File 'lib/hom.rb', line 21

def named?
  !numeric?
end

#numeric?Boolean



17
18
19
# File 'lib/hom.rb', line 17

def numeric?
  Numeric === @value
end

#to_sObject



13
14
15
# File 'lib/hom.rb', line 13

def to_s
  numeric? ? "&\##{value};" : "&#{value};"
end