Class: OsuRuby::Database::Datatype::Decimal

Inherits:
Struct
  • Object
show all
Defined in:
(osu-ruby2 0.0.2) osu-ruby2/database/datatype.rb
(osu-ruby2 0.0.2) osu-ruby2/database/datatype.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#flagsObject

Returns the value of attribute flags

Returns:

  • (Object)

    the current value of flags

#hiObject

Returns the value of attribute hi

Returns:

  • (Object)

    the current value of hi

#lowObject

Returns the value of attribute low

Returns:

  • (Object)

    the current value of low

#medObject

Returns the value of attribute med

Returns:

  • (Object)

    the current value of med

Class Method Details

.read_bytes(string) ⇒ Decimal

reads back the byte format that is created through #to_bytes

Parameters:

  • string (String)

    16-bytes of string

Returns:

.try_convert(value) ⇒ Decimal .try_convert(value) ⇒ Decimal .try_convert(value) ⇒ Decimal

Overloads:

  • .try_convert(value) ⇒ Decimal

    Parameters:

    • value (String)

      string that need to be split upon.

  • .try_convert(value) ⇒ Decimal

    Parameters:

    • value (Float, Rational)

      convert to string of float-form

  • .try_convert(value) ⇒ Decimal

    Parameters:

    • value (Integer)

Returns:

Raises:

  • (ArgumentError)

    failed convert attempt

Instance Method Details

#split(Integer, Integer)

splits integral and decimal part

Returns:

  • ((Integer, Integer))

    pair of integer

#to_bytesString

Converts the struct into 16-bytes of string.

Returns:

  • (String)

#to_dBigDecimal

Returns:

  • (BigDecimal)

#to_fFloat

Returns:

  • (Float)

#to_iInteger

Returns:

  • (Integer)

#to_intInteger

Returns:

  • (Integer)

#to_rRational

Returns:

  • (Rational)

#to_sString

Returns:

  • (String)