| Class | ActiveLdap::Ldif::ChangeRecord::Control |
| In: |
lib/active_ldap/ldif.rb
|
| Parent: | Object |
| type | [R] | |
| value | [R] |
# File lib/active_ldap/ldif.rb, line 717
717: def initialize(type, criticality, value)
718: @type = type
719: @criticality = normalize_criticality(criticality)
720: @value = value
721: end
# File lib/active_ldap/ldif.rb, line 747
747: def ==(other)
748: other.is_a?(self.class) and
749: @type == other.type and
750: @criticality = other.criticality and
751: @value == other.value
752: end
# File lib/active_ldap/ldif.rb, line 731
731: def to_hash
732: {
733: :type => @type,
734: :criticality => @criticality,
735: :value => @value,
736: }
737: end
# File lib/active_ldap/ldif.rb, line 739
739: def to_s
740: result = "control: #{@type}"
741: result << " #{@criticality}" unless @criticality.nil?
742: result << @value if @value
743: result << "\n"
744: result
745: end
# File lib/active_ldap/ldif.rb, line 755
755: def normalize_criticality(criticality)
756: case criticality
757: when "true", true
758: true
759: when "false", false
760: false
761: when nil
762: nil
763: else
764: raise ArgumentError,
765: _("invalid criticality value: %s") % criticality.inspect
766: end
767: end