Class: BinaryParser::BuiltInTemplate::Flag

Inherits:
TemplateBase show all
Defined in:
lib/binary_parser/built_in_template/flag.rb

Constant Summary

Constants included from BinaryParser::BuiltInTemplate

BCD, BCD_f1, BCD_f10, BCD_f2, BCD_f3, BCD_f4, BCD_f5, BCD_f6, BCD_f7, BCD_f8, BCD_f9

Instance Method Summary collapse

Methods inherited from TemplateBase

Def, #[], #binary_bit_length, #convert_into_abstract_binary, def_structure, def_var_method, #hold_enough_binary?, #hold_just_binary?, #initialize, #load, #names, #show, structure, #structure_bit_length, #to_chars, #to_i, #to_s

Methods included from BinaryParser::BuiltInTemplate

bcd_make

Constructor Details

This class inherits a constructor from BinaryParser::TemplateBase

Instance Method Details

#content_descriptionObject



17
18
19
# File 'lib/binary_parser/built_in_template/flag.rb', line 17

def content_description
  on? ? "true" : "false"
end

#off?Boolean Also known as: unflagged?

Returns:

  • (Boolean)


11
12
13
# File 'lib/binary_parser/built_in_template/flag.rb', line 11

def off?
  return !on?
end

#on?Boolean Also known as: flagged?

Returns:

  • (Boolean)


5
6
7
# File 'lib/binary_parser/built_in_template/flag.rb', line 5

def on?
  return to_i[0] == 1
end