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.



724
725
726
727
728
# File 'lib/active_ldap/ldif.rb', line 724

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.



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

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



754
755
756
757
758
759
# File 'lib/active_ldap/ldif.rb', line 754

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

#criticality?Boolean

Returns:

  • (Boolean)


730
731
732
# File 'lib/active_ldap/ldif.rb', line 730

def criticality?
  @criticality
end

#to_aObject



734
735
736
# File 'lib/active_ldap/ldif.rb', line 734

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

#to_hashObject



738
739
740
741
742
743
744
# File 'lib/active_ldap/ldif.rb', line 738

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

#to_sObject



746
747
748
749
750
751
752
# File 'lib/active_ldap/ldif.rb', line 746

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