Class: BinaryParser::BuiltInTemplate::Flag

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

Instance Method Summary collapse

Methods inherited from TemplateBase

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

Constructor Details

This class inherits a constructor from BinaryParser::TemplateBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BinaryParser::TemplateBase

Instance Method Details

#content_descriptionObject



17
18
19
# File 'lib/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/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/built_in_template/flag.rb', line 5

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