### Home Classes Methods

### In Files

- lib/active_ldap/ldif.rb

### Parent

Object

### Methods

- ::new
- #[]
- #check
- #check_separator
- #column
- #consumed_source
- #eos?
- #line
- #next_segment
- #position
- #scan
- #scan_separator
- #scan_separators

### Files

- USAGE

### Class/Module Index

Quicksearch

- ActiveLdap
- ActiveLdap::ActionController
- ActiveLdap::ActionController::LdapBenchmarking
- ActiveLdap::Acts
- ActiveLdap::Acts::Tree
- ActiveLdap::Acts::Tree::ClassMethods
- ActiveLdap::Adapter
- ActiveLdap::Adapter::Base
- ActiveLdap::Adapter::Jndi
- ActiveLdap::Adapter::JndiConnection
- ActiveLdap::Adapter::JndiConnection::ModifyRecord
- ActiveLdap::Adapter::JndiConnection::Scope
- ActiveLdap::Adapter::Ldap
- ActiveLdap::Adapter::Ldap::Method
- ActiveLdap::Adapter::Ldap::Method::Base
- ActiveLdap::Adapter::Ldap::Method::Plain
- ActiveLdap::Adapter::Ldap::Method::SSL
- ActiveLdap::Adapter::Ldap::Method::TLS
- ActiveLdap::Adapter::NetLdap
- ActiveLdap::Association
- ActiveLdap::Association::BelongsTo
- ActiveLdap::Association::BelongsToMany
- ActiveLdap::Association::Children
- ActiveLdap::Association::Collection
- ActiveLdap::Association::HasMany
- ActiveLdap::Association::HasManyUtils
- ActiveLdap::Association::HasManyWrap
- ActiveLdap::Association::Proxy
- ActiveLdap::Associations
- ActiveLdap::Associations::ClassMethods
- ActiveLdap::AttributeMethods
- ActiveLdap::AttributeMethods::BeforeTypeCast
- ActiveLdap::AttributeMethods::Dirty
- ActiveLdap::AttributeMethods::Query
- ActiveLdap::AttributeMethods::Read
- ActiveLdap::AttributeMethods::Write
- ActiveLdap::Attributes
- ActiveLdap::Attributes::ClassMethods
- ActiveLdap::Attributes::Normalizable
- ActiveLdap::Callbacks
- ActiveLdap::Callbacks::ClassMethods
- ActiveLdap::Command
- ActiveLdap::Compatible
- ActiveLdap::Configuration
- ActiveLdap::Configuration::ClassMethods
- ActiveLdap::Connection
- ActiveLdap::Connection::ClassMethods
- ActiveLdap::DN
- ActiveLdap::DistinguishedName
- ActiveLdap::DistinguishedName::Parser
- ActiveLdap::Entry
- ActiveLdap::EntryAttribute
- ActiveLdap::Escape
- ActiveLdap::Generators
- ActiveLdap::Generators::ModelGenerator
- ActiveLdap::Generators::ScaffoldGenerator
- ActiveLdap::GetText
- ActiveLdap::GetText::Parser
- ActiveLdap::GetTextSupport
- ActiveLdap::Helper
- ActiveLdap::HumanReadable
- ActiveLdap::HumanReadable::ClassMethods
- ActiveLdap::LDIF
- ActiveLdap::LdapError
- ActiveLdap::Ldif
- ActiveLdap::Ldif::AddRecord
- ActiveLdap::Ldif::Attribute
- ActiveLdap::Ldif::Attributes
- ActiveLdap::Ldif::ChangeRecord
- ActiveLdap::Ldif::ChangeRecord::Control
- ActiveLdap::Ldif::ContentRecord
- ActiveLdap::Ldif::DeleteRecord
- ActiveLdap::Ldif::ModifyDNRecord
- ActiveLdap::Ldif::ModifyNameRecord
- ActiveLdap::Ldif::ModifyRDNRecord
- ActiveLdap::Ldif::ModifyRecord
- ActiveLdap::Ldif::ModifyRecord::AddOperation
- ActiveLdap::Ldif::ModifyRecord::DeleteOperation
- ActiveLdap::Ldif::ModifyRecord::Operation
- ActiveLdap::Ldif::ModifyRecord::ReplaceOperation
- ActiveLdap::Ldif::Parser
- ActiveLdap::Ldif::Record
- ActiveLdap::Ldif::Scanner
- ActiveLdap::LogSubscriber
- ActiveLdap::ObjectClass
- ActiveLdap::ObjectClass::ClassMethods
- ActiveLdap::Operations
- ActiveLdap::Operations::ClassOnlyDelete
- ActiveLdap::Operations::ClassOnlyUpdate
- ActiveLdap::Operations::Common
- ActiveLdap::Operations::Delete
- ActiveLdap::Operations::Find
- ActiveLdap::Operations::LDIF
- ActiveLdap::Operations::LDIF::AddRecordLoadable
- ActiveLdap::Operations::LDIF::ContentRecordLoadable
- ActiveLdap::Operations::LDIF::DeleteRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyNameRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::AddOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::DeleteOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::ReplaceOperationModifiable
- ActiveLdap::Operations::Update
- ActiveLdap::Persistence
- ActiveLdap::Populate
- ActiveLdap::Railtie
- ActiveLdap::Railties
- ActiveLdap::Railties::ControllerRuntime
- ActiveLdap::Railties::ControllerRuntime::ClassMethods
- ActiveLdap::Schema
- ActiveLdap::Schema::Attribute
- ActiveLdap::Schema::Entry
- ActiveLdap::Schema::ObjectClass
- ActiveLdap::Schema::Syntax
- ActiveLdap::Schema::Syntaxes
- ActiveLdap::Schema::Syntaxes::Base
- ActiveLdap::Schema::Syntaxes::BitString
- ActiveLdap::Schema::Syntaxes::Boolean
- ActiveLdap::Schema::Syntaxes::CountryString
- ActiveLdap::Schema::Syntaxes::DirectoryString
- ActiveLdap::Schema::Syntaxes::DistinguishedName
- ActiveLdap::Schema::Syntaxes::GeneralizedTime
- ActiveLdap::Schema::Syntaxes::Integer
- ActiveLdap::Schema::Syntaxes::JPEG
- ActiveLdap::Schema::Syntaxes::NameAndOptionalUID
- ActiveLdap::Schema::Syntaxes::NumericString
- ActiveLdap::Schema::Syntaxes::OID
- ActiveLdap::Schema::Syntaxes::ObjectSecurityDescriptor
- ActiveLdap::Schema::Syntaxes::OctetString
- ActiveLdap::Schema::Syntaxes::OtherMailbox
- ActiveLdap::Schema::Syntaxes::PostalAddress
- ActiveLdap::Schema::Syntaxes::PrintableString
- ActiveLdap::Schema::Syntaxes::TelephoneNumber
- ActiveLdap::UserPassword
- ActiveLdap::UserPassword::Salt
- ActiveLdap::Validations
- ActiveLdap::XML
- ActiveLdap::Xml
- ActiveLdap::Xml::Serializer
- LDAP
- LDAP::Conn
- LDAP::Mod
- Net
- Net::LDAP
- Net::LDAP::Entry
- ActionView
- ActionView::Base
- URI
- URI::LDAPS
- Object
- Timeout

No matching classes.

# ActiveLdap::Ldif::Scanner

### Constants

SEPARATOR
SEPARATORS

### Public Class Methods

new(source) click to toggle source

    # File lib/active_ldap/ldif.rb, line 501
    def initialize(source)
      @source = source
      @scanner = StringScanner.new(@source)
      @sub_scanner = nil
      @sub_scanner = next_segment || StringScanner.new("")
    end

### Public Instance Methods

[](*args) click to toggle source

    # File lib/active_ldap/ldif.rb, line 543
    def [](*args)
      @sub_scanner[*args]
    end

check(regexp) click to toggle source

    # File lib/active_ldap/ldif.rb, line 513
    def check(regexp)
      @sub_scanner = next_segment if @sub_scanner.eos?
      @sub_scanner.check(regexp)
    end

check_separator() click to toggle source

    # File lib/active_ldap/ldif.rb, line 524
    def check_separator
      return @scanner.check(SEPARATOR) if @sub_scanner.eos?

      check(SEPARATOR)
    end

column() click to toggle source

    # File lib/active_ldap/ldif.rb, line 561
    def column
      _consumed_source = consumed_source
      return 1 if _consumed_source.empty?

      position - (_consumed_source.rindex("\n") || -1)
    end

eos?() click to toggle source

    # File lib/active_ldap/ldif.rb, line 547
    def eos?
      @sub_scanner = next_segment if @sub_scanner.eos?
      @sub_scanner.eos? and @scanner.eos?
    end

line() click to toggle source

    # File lib/active_ldap/ldif.rb, line 552
    def line
      _consumed_source = consumed_source
      return 1 if _consumed_source.empty?

      n = Compatible.string_to_lines(_consumed_source).size
      n += 1 if _consumed_source[-1, 1] == "\n"
      n
    end

position() click to toggle source

    # File lib/active_ldap/ldif.rb, line 568
    def position
      sub_scanner_string = @sub_scanner.string
      if sub_scanner_string.respond_to?(:bytesize)
        sub_scanner_string_size = sub_scanner_string.bytesize
      else
        sub_scanner_string_size = sub_scanner_string.size
      end
      @scanner.pos - (sub_scanner_string_size - @sub_scanner.pos)
    end

scan(regexp) click to toggle source

    # File lib/active_ldap/ldif.rb, line 508
    def scan(regexp)
      @sub_scanner = next_segment if @sub_scanner.eos?
      @sub_scanner.scan(regexp)
    end

scan_separator() click to toggle source

    # File lib/active_ldap/ldif.rb, line 518
    def scan_separator
      return @scanner.scan(SEPARATOR) if @sub_scanner.eos?

      scan(SEPARATOR)
    end

scan_separators() click to toggle source

    # File lib/active_ldap/ldif.rb, line 530
    def scan_separators
      return @scanner.scan(SEPARATORS) if @sub_scanner.eos?

      sub_result = scan(SEPARATORS)
      return nil if sub_result.nil?
      return sub_result unless @sub_scanner.eos?

      result = @scanner.scan(SEPARATORS)
      return sub_result if result.nil?

      sub_result + result
    end

### Private Instance Methods

consumed_source() click to toggle source

    # File lib/active_ldap/ldif.rb, line 588
    def consumed_source
      @source[0, position]
    end

next_segment() click to toggle source

    # File lib/active_ldap/ldif.rb, line 579
    def next_segment
      loop do
        segment = @scanner.scan(/.+(?:#{SEPARATOR} .*)*#{SEPARATOR}?/)
        return @sub_scanner if segment.nil?
        next if segment[0, 1] == "#"
        return StringScanner.new(segment.gsub(/\r?\n /, ''))
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.