Class: JavaClass::ClassFile::Constants::ConstantDouble

Inherits:
Value show all
Defined in:
lib/javaclass/classfile/constants/value.rb

Overview

ZenTest SKIP

Instance Attribute Summary

Attributes inherited from Value

#value

Attributes inherited from Base

#name, #size, #slots, #tag

Instance Method Summary collapse

Methods inherited from Base

#const_class?, #const_field?, #const_method?

Constructor Details

#initialize(pool, data, start) ⇒ ConstantDouble

Returns a new instance of ConstantDouble.



91
92
93
94
95
# File 'lib/javaclass/classfile/constants/value.rb', line 91

def initialize(pool, data, start)
  super()
  silence_unused_warning(pool)
  @value = get_value(data, start, 9, 2).double
end

Instance Method Details

#dumpObject



101
102
103
# File 'lib/javaclass/classfile/constants/value.rb', line 101

def dump
  super + 'd;'
end

#to_sObject



97
98
99
# File 'lib/javaclass/classfile/constants/value.rb', line 97

def to_s
  sprintf('%.14e', @value).sub(/e(\+|-)0+/, 'e\\1')
end