Class: ActiveLdap::Ldif::ModifyRecord::Operation

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

Direct Known Subclasses

AddOperation, DeleteOperation, ReplaceOperation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, attribute, options, attributes) ⇒ Operation

Returns a new instance of Operation.



878
879
880
881
882
883
# File 'lib/active_ldap/ldif.rb', line 878

def initialize(type, attribute, options, attributes)
  @type = type
  @attribute = attribute
  @options = options
  @attributes = attributes
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



877
878
879
# File 'lib/active_ldap/ldif.rb', line 877

def attribute
  @attribute
end

#attributesObject (readonly)

Returns the value of attribute attributes.



877
878
879
# File 'lib/active_ldap/ldif.rb', line 877

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



877
878
879
# File 'lib/active_ldap/ldif.rb', line 877

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



877
878
879
# File 'lib/active_ldap/ldif.rb', line 877

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



906
907
908
909
910
911
912
# File 'lib/active_ldap/ldif.rb', line 906

def ==(other)
  other.is_a?(self.class) and
    @type == other.type and
    full_attribute_name == other.full_attribute_name and
    Attributes.normalize(@attributes) ==
    Attributes.normalize(other.attributes)
end

#add?Boolean

Returns:

  • (Boolean)


889
890
891
# File 'lib/active_ldap/ldif.rb', line 889

def add?
  @type == "add"
end

#delete?Boolean

Returns:

  • (Boolean)


893
894
895
# File 'lib/active_ldap/ldif.rb', line 893

def delete?
  @type == "delete"
end

#full_attribute_nameObject



885
886
887
# File 'lib/active_ldap/ldif.rb', line 885

def full_attribute_name
  [@attribute, *@options].join(";")
end

#replace?Boolean

Returns:

  • (Boolean)


897
898
899
# File 'lib/active_ldap/ldif.rb', line 897

def replace?
  @type == "replace"
end

#to_sObject



901
902
903
904
# File 'lib/active_ldap/ldif.rb', line 901

def to_s
  Attribute.encode(@type, full_attribute_name) +
    Attributes.encode(@attributes)
end