Class: Badline::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/badline/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flags = [], value: 0x0) ⇒ Status

Returns a new instance of Status.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/badline/status.rb', line 7

def initialize(flags = [], value: 0x0)
  @flags = flags

  @bitmask = create_mask { |f| f.is_a?(Symbol) }
  @low_mask = create_mask { |f| f.is_a?(Integer) && f.zero? }
  @high_mask = create_mask { |f| f.is_a?(Integer) && f == 1 }

  self.value = value

  define_accessors!
end

Instance Attribute Details

#bitmaskObject (readonly)

Returns the value of attribute bitmask.



5
6
7
# File 'lib/badline/status.rb', line 5

def bitmask
  @bitmask
end

#flagsObject (readonly)

Returns the value of attribute flags.



5
6
7
# File 'lib/badline/status.rb', line 5

def flags
  @flags
end

#high_maskObject (readonly)

Returns the value of attribute high_mask.



5
6
7
# File 'lib/badline/status.rb', line 5

def high_mask
  @high_mask
end

#low_maskObject (readonly)

Returns the value of attribute low_mask.



5
6
7
# File 'lib/badline/status.rb', line 5

def low_mask
  @low_mask
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/badline/status.rb', line 5

def value
  @value
end