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