Class: HOM::Entity
- Inherits:
-
Object
- Object
- HOM::Entity
- Defined in:
- lib/hom.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #html_safe? ⇒ Boolean
-
#initialize(value) ⇒ Entity
constructor
A new instance of Entity.
- #named? ⇒ Boolean
- #numeric? ⇒ Boolean
- #to_s ⇒ Object
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
#value ⇒ Object (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
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_s ⇒ Object
13 14 15 |
# File 'lib/hom.rb', line 13 def to_s numeric? ? "&\##{value};" : "&#{value};" end |