Class: JavaClass::ClassFile::Constants::Value

Inherits:
Base
  • Object
show all
Defined in:
lib/javaclass/classfile/constants/value.rb

Overview

Superclass of value constants like ConstantInt (Integer) in the constant pool.

Author

Peter Kofler

Instance Attribute Summary collapse

Attributes inherited from Base

#name, #size, #slots, #tag

Instance Method Summary collapse

Constructor Details

#initialize(name = self.class.to_s[/::[^:]+$/][10..-1].downcase) ⇒ Value

Create a constant value with an optional downcase name



14
15
16
# File 'lib/javaclass/classfile/constants/value.rb', line 14

def initialize(name=self.class.to_s[/::[^:]+$/][10..-1].downcase)
  super(name)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



11
12
13
# File 'lib/javaclass/classfile/constants/value.rb', line 11

def value
  @value
end

Instance Method Details

#dumpObject

Return part of debug output.



24
25
26
# File 'lib/javaclass/classfile/constants/value.rb', line 24

def dump
  super + "#{@value}"
end

#to_sObject

Return the value as string.



19
20
21
# File 'lib/javaclass/classfile/constants/value.rb', line 19

def to_s
  @value.to_s
end