Class: OSPFv2::AuType
Instance Method Summary collapse
- #encode ⇒ Object (also: #enc)
- 
  
    
      #initialize(au_type = 0)  ⇒ AuType 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of AuType. 
- #to_hash ⇒ Object
- #to_i ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(au_type = 0) ⇒ AuType
| 27 28 29 30 31 32 33 34 35 36 | # File 'lib/ie/au_type.rb', line 27 def initialize(au_type=0) @au_type=0 case au_type when :null, 0 ; @au_type = 0 when :simple_password, 1 ; @au_type = 1 when :cryptographic, 2 ; @au_type = 2 else @au_type = au_type if au_type.is_a?(Integer) end end | 
Instance Method Details
#encode ⇒ Object Also known as: enc
| 60 61 62 | # File 'lib/ie/au_type.rb', line 60 def encode [@au_type].pack('n') end | 
#to_hash ⇒ Object
| 38 39 40 | # File 'lib/ie/au_type.rb', line 38 def to_hash to_sym end | 
#to_i ⇒ Object
| 42 43 44 | # File 'lib/ie/au_type.rb', line 42 def to_i @au_type end | 
#to_s ⇒ Object
| 46 47 48 | # File 'lib/ie/au_type.rb', line 46 def to_s self.class.to_s.split('::').last + ": #{au_to_s}" end | 
#to_sym ⇒ Object
| 50 51 52 53 54 55 56 57 58 | # File 'lib/ie/au_type.rb', line 50 def to_sym case @au_type when 2 ; :cryptographic when 1 ; :simple_password when 0 ; :null else :undefined? end end |