class Elemac::Property
Public Class Methods
new(address:, offset: 0, type: :int)
click to toggle source
# File lib/elemac/property.rb, line 3 def initialize(address:, offset: 0, type: :int) @address = address @offset = offset @type = type end
Public Instance Methods
get_address()
click to toggle source
# File lib/elemac/property.rb, line 20 def get_address (@offset + @address).to_s(16).upcase.rjust(3, '0') end
get_type(type)
click to toggle source
# File lib/elemac/property.rb, line 8 def get_type(type) case(type) when :char # 1 byte 'r0' when :short # 2 bytes 'r1' when :int # 3 bytes 'r2' when :long # 4 bytes 'r3' end end
to_s()
click to toggle source
# File lib/elemac/property.rb, line 23 def to_s "#{get_type(@type)}#{get_address}" end