Class: ActiveLdap::Ldif::ChangeRecord::Control

Inherits:
Object
  • Object
show all
Defined in:
lib/active_ldap/ldif.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, criticality, value) ⇒ Control

Returns a new instance of Control.



690
691
692
693
694
# File 'lib/active_ldap/ldif.rb', line 690

def initialize(type, criticality, value)
  @type = type
  @criticality = normalize_criticality(criticality)
  @value = value
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



689
690
691
# File 'lib/active_ldap/ldif.rb', line 689

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



689
690
691
# File 'lib/active_ldap/ldif.rb', line 689

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



720
721
722
723
724
725
# File 'lib/active_ldap/ldif.rb', line 720

def ==(other)
  other.is_a?(self.class) and
    @type == other.type and
    @criticality = other.criticality and
    @value == other.value
end

#criticality?Boolean

Returns:

  • (Boolean)


696
697
698
# File 'lib/active_ldap/ldif.rb', line 696

def criticality?
  @criticality
end

#to_aObject



700
701
702
# File 'lib/active_ldap/ldif.rb', line 700

def to_a
  [@type, @criticality, @value]
end

#to_hashObject



704
705
706
707
708
709
710
# File 'lib/active_ldap/ldif.rb', line 704

def to_hash
  {
    :type => @type,
    :criticality => @criticality,
    :value => @value,
  }
end

#to_sObject



712
713
714
715
716
717
718
# File 'lib/active_ldap/ldif.rb', line 712

def to_s
  result = "control: #{@type}"
  result << " #{@criticality}" unless @criticality.nil?
  result << @value if @value
  result << "\n"
  result
end