Class: Ucode::Models::CodePoint::NumericValue
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Ucode::Models::CodePoint::NumericValue
- Defined in:
- lib/ucode/models/codepoint/numeric_value.rb
Overview
Numeric value of a codepoint (UnicodeData.txt fields 7+8). Stored as numerator + denominator (Integers) so JSON serialization is exact (1/2, not 0.5). The Rational reconstruction is computed on demand via #to_r.
Instance Method Summary collapse
Instance Method Details
#is_decimal? ⇒ Boolean
23 24 25 |
# File 'lib/ucode/models/codepoint/numeric_value.rb', line 23 def is_decimal? type == "de" end |
#to_r ⇒ Object
27 28 29 30 31 |
# File 'lib/ucode/models/codepoint/numeric_value.rb', line 27 def to_r return Rational(0) if denominator.nil? || denominator.zero? Rational(numerator, denominator) end |