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

#flags ⇒ Object

Returns the value of attribute flags

Returns:

  • (Object) —

    the current value of flags

#hi ⇒ Object

Returns the value of attribute hi

Returns:

  • (Object) —

    the current value of hi

#low ⇒ Object

Returns the value of attribute low

Returns:

  • (Object) —

    the current value of low

#med ⇒ Object

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_bytes ⇒ String

Converts the struct into 16-bytes of string.

Returns:

  • (String)

#to_d ⇒ BigDecimal

Returns:

  • (BigDecimal)

#to_f ⇒ Float

Returns:

  • (Float)

#to_i ⇒ Integer

Returns:

  • (Integer)

#to_int ⇒ Integer

Returns:

  • (Integer)

#to_r ⇒ Rational

Returns:

  • (Rational)

#to_s ⇒ String

Returns:

  • (String)