| Class | ActiveLdap::Ldif::ChangeRecord::Control |
| In: |
lib/active_ldap/ldif.rb
|
| Parent: | Object |
| type | [R] | |
| value | [R] |
# File lib/active_ldap/ldif.rb, line 690
690: def initialize(type, criticality, value)
691: @type = type
692: @criticality = normalize_criticality(criticality)
693: @value = value
694: end
# File lib/active_ldap/ldif.rb, line 720
720: def ==(other)
721: other.is_a?(self.class) and
722: @type == other.type and
723: @criticality = other.criticality and
724: @value == other.value
725: end
# File lib/active_ldap/ldif.rb, line 704
704: def to_hash
705: {
706: :type => @type,
707: :criticality => @criticality,
708: :value => @value,
709: }
710: end
# File lib/active_ldap/ldif.rb, line 712
712: def to_s
713: result = "control: #{@type}"
714: result << " #{@criticality}" unless @criticality.nil?
715: result << @value if @value
716: result << "\n"
717: result
718: end
# File lib/active_ldap/ldif.rb, line 728
728: def normalize_criticality(criticality)
729: case criticality
730: when "true", true
731: true
732: when "false", false
733: false
734: when nil
735: nil
736: else
737: raise ArgumentError,
738: _("invalid criticality value: %s") % criticality.inspect
739: end
740: end