class JavaClass::ClassFile::Constants::Value
Superclass of value constants like ConstantInt
(Integer
) in the constant pool.
- Author
-
Peter Kofler
Attributes
value[R]
Public Class Methods
new(name=self.class.to_s[/::[^:]+$/][10..-1].downcase)
click to toggle source
Create a constant value with an optional downcase name
Calls superclass method
JavaClass::ClassFile::Constants::Base::new
# File lib/javaclass/classfile/constants/value.rb, line 14 def initialize(name=self.class.to_s[/::[^:]+$/][10..-1].downcase) super(name) end
Public Instance Methods
dump()
click to toggle source
Return part of debug output.
Calls superclass method
JavaClass::ClassFile::Constants::Base#dump
# File lib/javaclass/classfile/constants/value.rb, line 24 def dump super + to_s end
to_s()
click to toggle source
Return the value as string.
# File lib/javaclass/classfile/constants/value.rb, line 19 def to_s @value.to_s end
Protected Instance Methods
get_value(data, start, size, slots=1)
click to toggle source
Define a value
from data beginning at position start with the size in bytes and slots (1 or 2).
# File lib/javaclass/classfile/constants/value.rb, line 31 def get_value(data, start, size, slots=1) @tag = data.u1(start) @size = size @slots = slots data[start+1..start+size-1] end
silence_unused_warning(pool)
click to toggle source
Dummy method to “fix” unused warning of param pool in Eclipse.
# File lib/javaclass/classfile/constants/value.rb, line 40 def silence_unused_warning(pool) raise ArgumentError, 'pool is nil' unless pool end