Class: Numeric

Inherits:
Object
  • Object
show all
Includes:
SGML
Defined in:
lib/m500.rb

Direct Known Subclasses

Decimal, Fraction, Kettenbruch, Natural, Quotient, Real, ST, Sigma

Instance Method Summary collapse

Methods included from SGML

#tog_sgml_id

Instance Method Details

#coerce(other) ⇒ Object



255
256
257
258
259
260
261
# File 'lib/m500.rb', line 255

def coerce(other)
  if Natural === other or Counting === other or Zahlen === other  or Quotient === other or Fraction === other
    [other.to_i,self]
  else
    super
  end
end

#irrational?Boolean

Returns:

  • (Boolean)


249
250
251
# File 'lib/m500.rb', line 249

def irrational?
  false
end

#rational?Boolean

Returns:

  • (Boolean)


252
253
254
# File 'lib/m500.rb', line 252

def rational?
  true
end

#sgml_idObject



214
215
216
217
218
# File 'lib/m500.rb', line 214

def sgml_id
  ret = ""
  @idsgml ? ret = "id='#{self.class.to_s.downcase}#{self.object_id}' " : ret = ""
  ret
end

#to_DecObject



237
238
239
# File 'lib/m500.rb', line 237

def to_Dec
  self
end

#to_FracObject



231
232
233
# File 'lib/m500.rb', line 231

def to_Frac
  self
end

#to_KObject



243
244
245
# File 'lib/m500.rb', line 243

def to_K
  self
end

#to_NObject



222
223
224
# File 'lib/m500.rb', line 222

def to_N
  self
end

#to_N0Object



225
226
227
# File 'lib/m500.rb', line 225

def to_N0
  self
end

#to_QObject



234
235
236
# File 'lib/m500.rb', line 234

def to_Q
  self
end

#to_RObject



246
247
248
# File 'lib/m500.rb', line 246

def to_R
  self
end

#to_sgmlObject



219
220
221
# File 'lib/m500.rb', line 219

def to_sgml
  "<mn #{sgml_id}class='numeric'>#{self.to_s}</mn>"
end

#to_SigObject



240
241
242
# File 'lib/m500.rb', line 240

def to_Sig
  self
end

#to_ZObject



228
229
230
# File 'lib/m500.rb', line 228

def to_Z
  self
end