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.



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

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.



871
872
873
# File 'lib/active_ldap/ldif.rb', line 871

def attribute
  @attribute
end

#attributesObject (readonly)

Returns the value of attribute attributes.



871
872
873
# File 'lib/active_ldap/ldif.rb', line 871

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



871
872
873
# File 'lib/active_ldap/ldif.rb', line 871

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



871
872
873
# File 'lib/active_ldap/ldif.rb', line 871

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



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

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)


883
884
885
# File 'lib/active_ldap/ldif.rb', line 883

def add?
  @type == "add"
end

#delete?Boolean

Returns:

  • (Boolean)


887
888
889
# File 'lib/active_ldap/ldif.rb', line 887

def delete?
  @type == "delete"
end

#full_attribute_nameObject



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

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

#replace?Boolean

Returns:

  • (Boolean)


891
892
893
# File 'lib/active_ldap/ldif.rb', line 891

def replace?
  @type == "replace"
end

#to_sObject



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

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