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



316
317
318
319
320
321
322
# File 'lib/m500.rb', line 316

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)


310
311
312
# File 'lib/m500.rb', line 310

def irrational?
  false
end

#rational?Boolean

Returns:

  • (Boolean)


313
314
315
# File 'lib/m500.rb', line 313

def rational?
  true
end

#sgml_idObject



275
276
277
278
279
# File 'lib/m500.rb', line 275

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

#to_DecObject



298
299
300
# File 'lib/m500.rb', line 298

def to_Dec
  self
end

#to_FracObject



292
293
294
# File 'lib/m500.rb', line 292

def to_Frac
  self
end

#to_KObject



304
305
306
# File 'lib/m500.rb', line 304

def to_K
  self
end

#to_NObject



283
284
285
# File 'lib/m500.rb', line 283

def to_N
  self
end

#to_N0Object



286
287
288
# File 'lib/m500.rb', line 286

def to_N0
  self
end

#to_QObject



295
296
297
# File 'lib/m500.rb', line 295

def to_Q
  self
end

#to_RObject



307
308
309
# File 'lib/m500.rb', line 307

def to_R
  self
end

#to_sgmlObject



280
281
282
# File 'lib/m500.rb', line 280

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

#to_SigObject



301
302
303
# File 'lib/m500.rb', line 301

def to_Sig
  self
end

#to_ZObject



289
290
291
# File 'lib/m500.rb', line 289

def to_Z
  self
end