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

Returns a new instance of 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

#html_safe?Boolean

Returns:

  • (Boolean)


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

def html_safe?
  true
end

#named?Boolean

Returns:

  • (Boolean)


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

def named?
  !numeric?
end

#numeric?Boolean

Returns:

  • (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