Class: ActiveLdap::Ldif — activeldap - ActiveLdap

Class: ActiveLdap::Ldif

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

Defined Under Namespace

Modules: Attribute, Attributes Classes: AddRecord, ChangeRecord, ContentRecord, DeleteRecord, ModifyDNRecord, ModifyNameRecord, ModifyRDNRecord, ModifyRecord, Parser, Record, Scanner

Instance Attribute Summary (collapse)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Ldif) initialize(records = [])

Returns a new instance of Ldif



602
603
604
605
# File 'lib/active_ldap/ldif.rb', line 602

def initialize(records=[])
  @version = 1
  @records = records
end

Instance Attribute Details

- (Object) records (readonly)

Returns the value of attribute records



601
602
603
# File 'lib/active_ldap/ldif.rb', line 601

def records
  @records
end

- (Object) version (readonly)

Returns the value of attribute version



601
602
603
# File 'lib/active_ldap/ldif.rb', line 601

def version
  @version
end

Class Method Details

+ (Object) parse(ldif)



594
595
596
# File 'lib/active_ldap/ldif.rb', line 594

def parse(ldif)
  Parser.new(ldif).parse
end

Instance Method Details

- (Object) <<(record)



607
608
609
# File 'lib/active_ldap/ldif.rb', line 607

def <<(record)
  @records << record
end

- (Object) ==(other)



623
624
625
626
# File 'lib/active_ldap/ldif.rb', line 623

def ==(other)
  other.is_a?(self.class) and
    @version == other.version and @records == other.records
end

- (Object) each(&block)



611
612
613
# File 'lib/active_ldap/ldif.rb', line 611

def each(&block)
  @records.each(&block)
end

- (Object) to_s



615
616
617
618
619
620
621
# File 'lib/active_ldap/ldif.rb', line 615

def to_s
  result = "version: #{@version}\n"
  result << @records.collect do |record|
    record.to_s
  end.join("\n")
  result
end