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.



844
845
846
847
848
849
# File 'lib/active_ldap/ldif.rb', line 844

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.



843
844
845
# File 'lib/active_ldap/ldif.rb', line 843

def attribute
  @attribute
end

#attributesObject (readonly)

Returns the value of attribute attributes.



843
844
845
# File 'lib/active_ldap/ldif.rb', line 843

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



843
844
845
# File 'lib/active_ldap/ldif.rb', line 843

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



843
844
845
# File 'lib/active_ldap/ldif.rb', line 843

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



872
873
874
875
876
877
878
# File 'lib/active_ldap/ldif.rb', line 872

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)


855
856
857
# File 'lib/active_ldap/ldif.rb', line 855

def add?
  @type == "add"
end

#delete?Boolean

Returns:

  • (Boolean)


859
860
861
# File 'lib/active_ldap/ldif.rb', line 859

def delete?
  @type == "delete"
end

#full_attribute_nameObject



851
852
853
# File 'lib/active_ldap/ldif.rb', line 851

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

#replace?Boolean

Returns:

  • (Boolean)


863
864
865
# File 'lib/active_ldap/ldif.rb', line 863

def replace?
  @type == "replace"
end

#to_sObject



867
868
869
870
# File 'lib/active_ldap/ldif.rb', line 867

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