class TextParts
Numeral parts represented in text form
Attributes
detect_repeat[RW]
exponent_base_value[RW]
exponent_value[RW]
integer_value[RW]
numeral[R]
Public Class Methods
new(numeral = nil)
click to toggle source
# File lib/numerals/format/text_parts.rb, line 17 def initialize(numeral = nil) @numeral = numeral @special = nil @sign = @integer = @fractional = @repeat = @exponent = @exponent_base = nil @integer_value = @exponent_value = @exponent_base_value = nil @detect_repeat = false end
text_part(*names)
click to toggle source
# File lib/numerals/format/text_parts.rb, line 5 def self.text_part(*names) names.each do |name| attr_writer name.to_sym define_method name do instance_variable_get("@#{name}") || "" end define_method :"#{name}?" do !send(name.to_sym).empty? end end end
Public Instance Methods
detect_repeat?()
click to toggle source
# File lib/numerals/format/text_parts.rb, line 31 def detect_repeat? @detect_repeat end
show_point?(format)
click to toggle source
# File lib/numerals/format/text_parts.rb, line 35 def show_point?(format) format.symbols.show_point || fractional? || repeat? end