Class: JavaClass::Constants::Base
- Inherits:
-
Object
- Object
- JavaClass::Constants::Base
- Defined in:
- lib/javaclass/constants/base.rb
Overview
Superclass of constant values in the constant pool. Every constant has a name
, a tag
and a size
in bytes.
- Author
-
Peter Kofler
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#slots ⇒ Object
readonly
Returns the value of attribute slots.
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
-
#dump ⇒ Object
Return part of debug output.
-
#initialize(name = nil) ⇒ Base
constructor
Set default constants.
Constructor Details
#initialize(name = nil) ⇒ Base
Set default constants.
16 17 18 19 20 21 |
# File 'lib/javaclass/constants/base.rb', line 16 def initialize(name=nil) @name = self.class.to_s[/::[^:]+$/][10..-1] # skip modules (::) and "Constant" @name = name if name @size = 3 @slots = 1 end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/javaclass/constants/base.rb', line 10 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
12 13 14 |
# File 'lib/javaclass/constants/base.rb', line 12 def size @size end |
#slots ⇒ Object (readonly)
Returns the value of attribute slots.
13 14 15 |
# File 'lib/javaclass/constants/base.rb', line 13 def slots @slots end |
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
11 12 13 |
# File 'lib/javaclass/constants/base.rb', line 11 def tag @tag end |
Instance Method Details
#dump ⇒ Object
Return part of debug output.
24 25 26 |
# File 'lib/javaclass/constants/base.rb', line 24 def dump "#{@name}\t" # #{@tag} end |